From 83a3451758df6b384238a1c95c54079c2f675d4f Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:22:09 +0100 Subject: [PATCH 1/3] If a message could not be deleted, drop the request --- src/SlackEventHandler.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SlackEventHandler.ts b/src/SlackEventHandler.ts index df9d02e1..38dec57c 100644 --- a/src/SlackEventHandler.ts +++ b/src/SlackEventHandler.ts @@ -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 { @@ -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. From 27867e27353faf1305a84e32d30de0d19457162e Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:23:32 +0100 Subject: [PATCH 2/3] Newsfile --- changelog.d/257.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/257.bugfix diff --git a/changelog.d/257.bugfix b/changelog.d/257.bugfix new file mode 100644 index 00000000..862414d8 --- /dev/null +++ b/changelog.d/257.bugfix @@ -0,0 +1 @@ +Fix .toUpperCase() errors \ No newline at end of file From 40a6ee35a6a03303f1abd1d26bc61fad8ed7f5bd Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 24 Sep 2019 15:28:34 +0100 Subject: [PATCH 3/3] Detailed error --- changelog.d/257.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/257.bugfix b/changelog.d/257.bugfix index 862414d8..9218cb6e 100644 --- a/changelog.d/257.bugfix +++ b/changelog.d/257.bugfix @@ -1 +1 @@ -Fix .toUpperCase() errors \ No newline at end of file +Fix .toUpperCase() errors due to the bridge trying to handle unknown deleted messages