-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User correct Matrix accounts when redacting events #780
User correct Matrix accounts when redacting events #780
Conversation
This makes us the original sender's intent to redact messages, so that we do not require an elevated PL to handle message deletion.
@@ -50,6 +50,7 @@ export interface ISlackEventMessageAttachment { | |||
} | |||
|
|||
export interface ISlackMessageEvent extends ISlackEvent { | |||
team?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not actually seen team_id
in incoming Slack messages, and the only place I see it used is when it's artificially assigned to in SlackRTMHandler – perhaps it's an error in our typing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really remember when this was introduced, it's possible it's invalid and team_id is the right one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts.
src/SlackEventHandler.ts
Outdated
} | ||
else { | ||
const ghost = await this.main.ghostStore.get(previousMessage.user, previousMessage.team_domain, previousMessage.team); | ||
await ghost.redactEvent(originalEvent.roomId, originalEvent.eventId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we try with the botClient if this fails, as a fallback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b4f2911
src/SlackEventHandler.ts
Outdated
} | ||
} | ||
else if (!previousMessage.user) { | ||
log.error("Cannot redact Slack message if we don't know the original sender:", previousMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just use the botClient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b4f2911; this has a side effect of us trying to delete messages sent by originally-Matrix users with the slack bot – which probably makes sense.
@@ -50,6 +50,7 @@ export interface ISlackEventMessageAttachment { | |||
} | |||
|
|||
export interface ISlackMessageEvent extends ISlackEvent { | |||
team?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really remember when this was introduced, it's possible it's invalid and team_id is the right one.
…rmine a more fitting user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go after changelog.
Added in e2df892 |
Fixes #766
For events sent from Slack and later deleted from Slack, we use the same Slack Ghost that sent the message – this alleviates the need for an elevated Power Level.
For events sent from Matrix and deleted from Slack, we try to use our bot account. This does require us to have a sufficient power level, so we try to be helpful in the logs if we don't.
Note: Slack doesn't tell us who deleted the message, so we can't bridge that precisely – the sender of a redact event is just our best effort.