From 458b33285a43f615346d4afa8443f146b3566a6f Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 18 Sep 2019 13:57:01 +0100 Subject: [PATCH 01/17] Update datastores.md with more details --- docs/datastores.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/datastores.md b/docs/datastores.md index bfe75bae..ade3c9b9 100644 --- a/docs/datastores.md +++ b/docs/datastores.md @@ -46,12 +46,13 @@ Migrating from an existing NeDB installation ```bash npm run build -node lib/scripts/migrateToPostgres.js "connectionString" "dbdir" +node lib/scripts/migrateToPostgres.js "connectionString" "dbDir" "slackPrefix" ``` -Where you should replace `connectionString` with the value above (such as -`postgresql://slackbridge_user:somethingverysecret@localhost/slack_bridge?sslmode=require`), and `dbdir` -*if* you stored your data files in a custom location. +Where you should replace: +- `connectionString` with the value above (such as `postgresql://slackbridge_user:somethingverysecret@localhost/slack_bridge?sslmode=require`) +- `dbDir` with the absolute path to your data files +- `slackPrefix` with the prefix of your slack ghost users (e.g. "@slack_") Once this process has completed and no errors have occured, you may begin using your brand new PostgreSQL database. From bb3a63360ea5649be2e530b2b7cd81f42b2b4002 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Thu, 19 Sep 2019 12:10:42 +0100 Subject: [PATCH 02/17] Create 239.misc --- changelog.d/239.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/239.misc diff --git a/changelog.d/239.misc b/changelog.d/239.misc new file mode 100644 index 00000000..fc84b6be --- /dev/null +++ b/changelog.d/239.misc @@ -0,0 +1 @@ +Update datastore.md with a few more options From ccdaaa0652e8eb3694c14bf555956018133add23 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 24 Sep 2019 13:21:23 +0100 Subject: [PATCH 03/17] s/-/\// --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0f97a852..e2b7342e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ # The name of your Python package filename = "CHANGELOG.md" directory = "changelog.d" - issue_format = "[\\#{issue}](https://github.com/matrix-org/matrix-appservice-slack-issues/{issue})" + issue_format = "[\\#{issue}](https://github.com/matrix-org/matrix-appservice-slack/issues/{issue})" [[tool.towncrier.type]] directory = "feature" @@ -27,4 +27,4 @@ [[tool.towncrier.type]] directory = "misc" name = "Internal Changes" - showcontent = true \ No newline at end of file + showcontent = true From eaa86edaadf8b3aa66806d4885cef8041709596c Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 24 Sep 2019 13:22:34 +0100 Subject: [PATCH 04/17] Create 251.misc --- changelog.d/251.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/251.misc diff --git a/changelog.d/251.misc b/changelog.d/251.misc new file mode 100644 index 00000000..a24162cc --- /dev/null +++ b/changelog.d/251.misc @@ -0,0 +1 @@ +Fix issue where towncrier would wrongly link to matrix-appservice-slack-issues From 875298a0f695a75f0c997615d4fe1ff71f3f0e50 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 13:56:01 +0100 Subject: [PATCH 05/17] Allow puppeting to be left off provisioning requests --- src/Provisioning.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Provisioning.ts b/src/Provisioning.ts index 2b62eddb..f7696cf7 100644 --- a/src/Provisioning.ts +++ b/src/Provisioning.ts @@ -26,7 +26,7 @@ const log = Logging.get("Provisioning"); type CommandFunc = (main: Main, req: Request, res: Response, ...params: string[]) => void|Promise; export const commands: {[verb: string]: Command} = {}; -type Param = string; +type Param = string | { param: string, required: boolean}; export class Command { private params: Param[]; @@ -40,12 +40,14 @@ export class Command { const body = req.body; const args: [Main, Request, Response, ...string[]] = [main, req, res]; for (const param of this.params) { - if (!(param in body)) { + const paramName = typeof(param) === "string" ? param : param.param; + const paramRequired = typeof(param) === "string" ? true : param.required; + if (!(paramName in body) && paramRequired) { res.status(HTTP_CODES.CLIENT_ERROR).json({error: `Required parameter ${param} missing`}); return; } - args.push(body[param]); + args.push(body[paramName]); } try { @@ -92,7 +94,7 @@ commands.getbotid = new Command({ }); commands.authurl = new Command({ - params: ["user_id", "puppeting"], + params: ["user_id", { param: "puppeting", required: false}], func(main, req, res, userId, puppeting) { if (!main.oauth2) { res.status(HTTP_CODES.CLIENT_ERROR).json({ From 3c775ac9a94fe0bc8cd58c155f1c6894c61bb98d Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 14:34:50 +0100 Subject: [PATCH 06/17] Add tests for provisioning getauth request --- src/OAuth2.ts | 2 +- src/tests/unit/ProvisioningTest.ts | 112 +++++++++++++++++++++++++++++ src/tests/utils/fakeExpress.ts | 17 +++++ src/tests/utils/fakeMain.ts | 22 ++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 src/tests/unit/ProvisioningTest.ts create mode 100644 src/tests/utils/fakeExpress.ts diff --git a/src/OAuth2.ts b/src/OAuth2.ts index 8356bbba..2942832c 100644 --- a/src/OAuth2.ts +++ b/src/OAuth2.ts @@ -60,7 +60,7 @@ export class OAuth2 { public makeAuthorizeURL(room: string|BridgedRoom, state: string, isPuppeting: boolean = false): string { const redirectUri = this.makeRedirectURL(room); - const scopes = isPuppeting ? REQUIRED_SCOPES : PUPPET_SCOPES; + const scopes = isPuppeting ? PUPPET_SCOPES : REQUIRED_SCOPES; const qs = querystring.stringify({ client_id: this.clientId, diff --git a/src/tests/unit/ProvisioningTest.ts b/src/tests/unit/ProvisioningTest.ts new file mode 100644 index 00000000..6cefbbb9 --- /dev/null +++ b/src/tests/unit/ProvisioningTest.ts @@ -0,0 +1,112 @@ +/* +Copyright 2019 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// tslint:disable: no-unused-expression no-any + +import { commands } from "../../Provisioning"; +import { FakeMain } from "../utils/fakeMain"; +import { expect } from "chai"; +import { FakeExpressResponse } from "../utils/fakeExpress"; + +// tslint:disable-next-line: max-line-length +const OAuthUrlRegex = /^https:\/\/slack\.com\/oauth\/authorize\?client_id=fakeid&redirect_uri=redir_prefix([0-9a-z-]+)%2Fauthorize&scope=(.*)&state=([0-9a-z-]+)$/; + +describe("Provisioning", () => { + describe("commands.authurl", () => { + it ("should not handle command with missing body parameters", async () => { + const fakeMain = new FakeMain(); + const req = { + body: { }, + }; + const res = new FakeExpressResponse(); + await commands.authurl.run(fakeMain as any, req as any, res as any); + expect(res.Status).to.equal(400); + expect(res.Json).to.deep.equal({ + error: "Required parameter user_id missing", + }); + }); + it ("should not handle command with disabled oauth2", async () => { + const fakeMain = new FakeMain({ oauth2: false }); + const req = { + body: { + user_id: "foobar", + }, + }; + const res = new FakeExpressResponse(); + await commands.authurl.run(fakeMain as any, req as any, res as any); + expect(res.Status).to.equal(400); + expect(res.Json).to.deep.equal({ + error: "OAuth2 not configured on this bridge", + }); + }); + it ("should handle command with missing puppeting body parameter", async () => { + const fakeMain = new FakeMain({ oauth2: true }); + const req = { + body: { + user_id: "foobar", + }, + }; + const res = new FakeExpressResponse(); + await commands.authurl.run(fakeMain as any, req as any, res as any); + expect(res.Status).to.equal(200); + expect(res.Json).to.exist; + const match = OAuthUrlRegex.exec(res.Json.auth_uri); + expect(match).is.not.null; + expect(match![1]).to.equal(match![3]); + expect(match![2]).to.equal( + "team%3Aread%2Cusers%3Aread%2Cchannels%3Ahistory%2Cchannels%3Aread%2Cfiles%3Awrite%3Auser%2Cchat%3Awrite%3Abot%2Cusers%3Aread%2Cbot", + ); + }); + it ("should handle command with missing puppeting body parameter set to false", async () => { + const fakeMain = new FakeMain({ oauth2: true }); + const req = { + body: { + user_id: "foobar", + puppeting: "false", + }, + }; + const res = new FakeExpressResponse(); + await commands.authurl.run(fakeMain as any, req as any, res as any); + expect(res.Status).to.equal(200); + expect(res.Json).to.exist; + const match = OAuthUrlRegex.exec(res.Json.auth_uri); + expect(match).is.not.null; + expect(match![1]).to.equal(match![3]); + expect(match![2]).to.equal( + "team%3Aread%2Cusers%3Aread%2Cchannels%3Ahistory%2Cchannels%3Aread%2Cfiles%3Awrite%3Auser%2Cchat%3Awrite%3Abot%2Cusers%3Aread%2Cbot", + ); + }); + it ("should handle command with missing puppeting body parameter set to true", async () => { + const fakeMain = new FakeMain({ oauth2: true }); + const req = { + body: { + user_id: "foobar", + puppeting: "true", + }, + }; + const res = new FakeExpressResponse(); + await commands.authurl.run(fakeMain as any, req as any, res as any); + expect(res.Status).to.equal(200); + expect(res.Json).to.exist; + const match = OAuthUrlRegex.exec(res.Json.auth_uri); + expect(match).is.not.null; + expect(match![1]).to.equal(match![3]); + expect(match![2]).to.equal( + "client", + ); + }); + }); +}); diff --git a/src/tests/utils/fakeExpress.ts b/src/tests/utils/fakeExpress.ts new file mode 100644 index 00000000..c0f6ae0d --- /dev/null +++ b/src/tests/utils/fakeExpress.ts @@ -0,0 +1,17 @@ +// tslint:disable: no-any + +export class FakeExpressResponse { + public Status: number = 200; + public Json: any = {}; + constructor() { } + + public status(s: number): FakeExpressResponse { + this.Status = s; + return this; + } + + public json(json: any): FakeExpressResponse { + this.Json = json; + return this; + } +} diff --git a/src/tests/utils/fakeMain.ts b/src/tests/utils/fakeMain.ts index 79e5b530..1334ede1 100644 --- a/src/tests/utils/fakeMain.ts +++ b/src/tests/utils/fakeMain.ts @@ -1,4 +1,26 @@ +import { OAuth2 } from "../../OAuth2"; + +const DEFAULT_OPTS = { + oauth2: false, +}; + +interface Opts { + oauth2: boolean; +} + export class FakeMain { + protected oauth2?: OAuth2; + constructor(opts: Opts = DEFAULT_OPTS) { + if (opts.oauth2) { + this.oauth2 = new OAuth2({ + // tslint:disable-next-line: no-any + main: this as any, + client_id: "fakeid", + client_secret: "fakesecret", + redirect_prefix: "redir_prefix", + }); + } + } public readonly timerFinished: {[eventName: string]: string } = {}; public clientFactory: FakeClientFactory = new FakeClientFactory(); From 966f1e7ea646cf7a73865e320ca85048231b6c92 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 14:47:46 +0100 Subject: [PATCH 07/17] Add newsfile --- changelog.d/254.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/254.bugfix diff --git a/changelog.d/254.bugfix b/changelog.d/254.bugfix new file mode 100644 index 00000000..c2f42c87 --- /dev/null +++ b/changelog.d/254.bugfix @@ -0,0 +1 @@ +Connecting an account via OAuth will no longer barf on the lack of a `puppeting` parameter \ No newline at end of file From cfe26ff522884b3917cd1abf9726923896bab0f7 Mon Sep 17 00:00:00 2001 From: David Vo Date: Tue, 24 Sep 2019 23:00:13 +1000 Subject: [PATCH 08/17] Fix multi-person DMs being registered as groups is_group is set in addition to is_mpim by the Slack API. Signed-off-by: David Vo --- changelog.d/253.bugfix | 1 + src/BridgedRoom.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog.d/253.bugfix diff --git a/changelog.d/253.bugfix b/changelog.d/253.bugfix new file mode 100644 index 00000000..18272fda --- /dev/null +++ b/changelog.d/253.bugfix @@ -0,0 +1 @@ +Fix multi-person DMs being marked with the group (private channel) type rather than the mpim type. diff --git a/src/BridgedRoom.ts b/src/BridgedRoom.ts index ad079726..c2b964dc 100644 --- a/src/BridgedRoom.ts +++ b/src/BridgedRoom.ts @@ -183,10 +183,11 @@ export class BridgedRoom { this.setValue("isPrivate", chan.is_private); if (chan.is_channel) { this.setValue("slackType", "channel"); - } else if (chan.is_group) { - this.setValue("slackType", "group"); } else if (chan.is_mpim) { + // note: is_group is also set for mpims, so order is important this.setValue("slackType", "mpim"); + } else if (chan.is_group) { + this.setValue("slackType", "group"); } else if (chan.is_im) { this.setValue("slackType", "im"); } else { From c418a9992cc3f16d0a3506fac321b64719367be7 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 14:56:55 +0100 Subject: [PATCH 09/17] Don't log stack traces for unknown teams/rooms/event --- src/SlackEventHandler.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/SlackEventHandler.ts b/src/SlackEventHandler.ts index d496d92a..df9d02e1 100644 --- a/src/SlackEventHandler.ts +++ b/src/SlackEventHandler.ts @@ -75,7 +75,7 @@ export class SlackEventHandler extends BaseSlackHandler { // We must respond within 3 seconds or it will be sent again! response(HTTP_OK, "OK"); - let err: string|null = null; + let err: Error|null = null; try { switch (event.type) { case "message": @@ -97,36 +97,35 @@ export class SlackEventHandler extends BaseSlackHandler { // XXX: Unused? case "file_comment_added": default: - err = "unknown_event"; + err = Error("unknown_event"); } } catch (ex) { log.warn("Didn't handle event"); err = ex; } - if (err === "unknown_channel") { + if (err === null) { + endTimer({outcome: "success"}); + } else if (!(err instanceof Error)) { + log.warn("Error when handing event:", err); + endTimer({outcome: "fail"}); + } else if (err.message === "unknown_channel") { const chanIdMix = `${event.channel} (${teamId})`; log.warn(`Ignoring message from unrecognised slack channel id: ${chanIdMix}`); this.main.incCounter("received_messages", {side: "remote"}); endTimer({outcome: "dropped"}); return; - } else if (err === "unknown_team") { + } else if (err.message === "unknown_team") { log.warn(`Ignoring message from unrecognised slack team id: ${teamId}`); this.main.incCounter("received_messages", {side: "remote"}); endTimer({outcome: "dropped"}); return; - } else if (err === "unknown_event") { + } else if (err.message === "unknown_event") { endTimer({outcome: "dropped"}); - } else if (err !== null) { + } else { log.warn("Error when handing event:", err); endTimer({outcome: "fail"}); } - - if (err === null) { - endTimer({outcome: "success"}); - } else { - log.error("Failed to handle slack event:", err); - } } catch (e) { log.error("SlackEventHandler.handle failed:", e); } From ba5ee898d0abd00e65b47ee73c869535eb42c51c Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:02:35 +0100 Subject: [PATCH 10/17] add newsfile --- changelog.d/255.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/255.bugfix diff --git a/changelog.d/255.bugfix b/changelog.d/255.bugfix new file mode 100644 index 00000000..738fb2c3 --- /dev/null +++ b/changelog.d/255.bugfix @@ -0,0 +1 @@ +Don't log stack traces for missing rooms, teams or events \ No newline at end of file From f2af697e33a3d518b62af4d000530d52e27c198f Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:04:53 +0100 Subject: [PATCH 11/17] less obnoxious errors in BridgedRoom --- src/BridgedRoom.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/BridgedRoom.ts b/src/BridgedRoom.ts index ad079726..c4515abf 100644 --- a/src/BridgedRoom.ts +++ b/src/BridgedRoom.ts @@ -275,7 +275,7 @@ export class BridgedRoom { log.info(`Reaction :${emojiKeyName}: added to ${event.slackTs}`); if (!res.ok) { - log.error("HTTP Error: ", res); + log.error("HTTP Error: ", res.error); return; } // TODO: Add this event to the event store @@ -300,8 +300,9 @@ export class BridgedRoom { ts: event.slackTs, }); - if (!res) { - log.error("HTTP Error: ", res); + if (!res.ok) { + log.error("HTTP Error: ", res.error); + return; } return res; } @@ -333,8 +334,8 @@ export class BridgedRoom { })) as ChatUpdateResponse; this.main.incCounter(METRIC_SENT_MESSAGES, {side: "remote"}); - if (!res) { - log.error("HTTP Error: ", res); + if (!res.ok) { + log.error("HTTP Error: ", res.error); return; } // Add this event to the event store @@ -412,7 +413,7 @@ export class BridgedRoom { this.main.incCounter(METRIC_SENT_MESSAGES, {side: "remote"}); if (!res.ok) { - log.error("HTTP Error: ", res); + log.error("HTTP Error: ", res.error); return; } From 3b8934908fac89968f196db706cdde76c6a31efe Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:06:44 +0100 Subject: [PATCH 12/17] Less obnoxious error reporting for other things too --- src/Main.ts | 2 +- src/Provisioning.ts | 2 +- src/SlackGhost.ts | 13 +++++++++---- src/SlackHookHandler.ts | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Main.ts b/src/Main.ts index 930d939c..c04ec661 100644 --- a/src/Main.ts +++ b/src/Main.ts @@ -940,7 +940,7 @@ export class Main { const infoRes = (await slackClient.conversations.info({ channel: opts.slack_channel_id})) as ConversationsInfoResponse; if (!infoRes.ok) { - log.error(`conversations.info for ${opts.slack_channel_id} errored:`, infoRes); + log.error(`conversations.info for ${opts.slack_channel_id} errored:`, infoRes.error); throw Error("Failed to get channel info"); } room.setBotClient(slackClient); diff --git a/src/Provisioning.ts b/src/Provisioning.ts index f7696cf7..7c71d2ab 100644 --- a/src/Provisioning.ts +++ b/src/Provisioning.ts @@ -157,7 +157,7 @@ commands.channels = new Command({ types: "public_channel", // TODO: In order to show private channels, we need the identity of the caller. })) as ConversationsListResponse; if (!response.ok) { - log.error(`Failed trying to fetch channels for ${teamId}.`, response); + log.error(`Failed trying to fetch channels for ${teamId}.`, response.error); res.status(HTTP_CODES.SERVER_ERROR).json({error: "Failed to fetch channels"}); return; } diff --git a/src/SlackGhost.ts b/src/SlackGhost.ts index 6e63909d..0561bb70 100644 --- a/src/SlackGhost.ts +++ b/src/SlackGhost.ts @@ -136,7 +136,7 @@ export class SlackGhost { public async getBotName(botId: string, client: WebClient) { const response = (await client.bots.info({ bot: botId})) as BotsInfoResponse; if (!response.ok || !response.bot.name) { - log.error("Failed to get bot name", response); + log.error("Failed to get bot name", response.error); return; } return response.bot.name; @@ -144,13 +144,18 @@ export class SlackGhost { public async getBotAvatarUrl(botId: string, client: WebClient) { const response = (await client.bots.info({ bot: botId})) as BotsInfoResponse; - if (!response.ok || !response.bot.icons.image_72) { - log.error("Failed to get bot name", response); + if (!response.ok) { + log.error("Failed to get bot name", response.error); return; } const icons = response.bot.icons; - return icons.image_original || icons.image_1024 || icons.image_512 || + const icon = icons.image_original || icons.image_1024 || icons.image_512 || icons.image_192 || icons.image_72 || icons.image_48; + if (!icon) { + log.error("No suitable icon for bot"); + return; + } + return icon; } public async lookupUserInfo(client: WebClient) { diff --git a/src/SlackHookHandler.ts b/src/SlackHookHandler.ts index 7dd2b517..062b97b1 100644 --- a/src/SlackHookHandler.ts +++ b/src/SlackHookHandler.ts @@ -391,7 +391,7 @@ export class SlackHookHandler extends BaseSlackHandler { })) as ConversationsHistoryResponse; if (!response.ok || !response.messages || response.messages.length === 0) { - log.warn("Could not find history: " + response); + log.warn("Could not find history: " + response.error); throw Error("Could not find history"); } if (response.messages.length !== 1) { From d856a16f269346b4e9b157c8d68bd929c1594e4f Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:08:39 +0100 Subject: [PATCH 13/17] Newsfile --- changelog.d/256.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/256.bugfix diff --git a/changelog.d/256.bugfix b/changelog.d/256.bugfix new file mode 100644 index 00000000..63a8b93c --- /dev/null +++ b/changelog.d/256.bugfix @@ -0,0 +1 @@ +Don't log the whole response object when an error occurs when sending slack requests \ No newline at end of file From 83a3451758df6b384238a1c95c54079c2f675d4f Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:22:09 +0100 Subject: [PATCH 14/17] 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 15/17] 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 d92011854a6652933bb09cc2bd04c4f62afd69af Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 24 Sep 2019 15:25:22 +0100 Subject: [PATCH 16/17] Towncrier should check against develop for changes on changelogs --- .buildkite/pipeline.yml | 2 +- changelog.d/258.misc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/258.misc diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9b2f3fa9..598fb94c 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -37,7 +37,7 @@ steps: branches: "!master !develop !release-*" command: - "python3 -m pip install towncrier" - - "python3 -m towncrier.check" + - "python3 -m towncrier.check --compare-with=origin/develop" plugins: - docker#v3.0.1: image: "python:3.6" diff --git a/changelog.d/258.misc b/changelog.d/258.misc new file mode 100644 index 00000000..6cb94a35 --- /dev/null +++ b/changelog.d/258.misc @@ -0,0 +1 @@ +Towncrier should check against develop for changelog changes \ 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 17/17] 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