Skip to content

Commit

Permalink
Merge pull request #257 from matrix-org/hs/drop-undeletables
Browse files Browse the repository at this point in the history
If a message could not be deleted, drop the request
  • Loading branch information
Half-Shot authored Sep 24, 2019
2 parents 7c45796 + 40a6ee3 commit cddb674
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/257.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix .toUpperCase() errors due to the bridge trying to handle unknown deleted messages
6 changes: 6 additions & 0 deletions src/SlackEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export class SlackEventHandler extends BaseSlackHandler {
this.main.incCounter("received_messages", {side: "remote"});
endTimer({outcome: "dropped"});
return;
} else if (err.message === "unknown_message") {
log.warn(`Ignoring event because we couldn't find a referred to message`);
endTimer({outcome: "dropped"});
return;
} else if (err.message === "unknown_event") {
endTimer({outcome: "dropped"});
} else {
Expand Down Expand Up @@ -213,6 +217,8 @@ export class SlackEventHandler extends BaseSlackHandler {
const botClient = this.main.botIntent.getClient();
return botClient.redactEvent(originalEvent.roomId, originalEvent.eventId);
}
// If we don't have the event
throw Error("unknown_message");
} else if (msg.subtype === "message_replied") {
// Slack sends us one of these as well as a normal message event
// when using RTM, so we ignore it.
Expand Down

0 comments on commit cddb674

Please sign in to comment.