-
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
Implement RMAU limits and bridge blocking #612
Conversation
src/datastore/NedbDatastore.ts
Outdated
@@ -63,6 +65,14 @@ export class NedbDatastore implements Datastore { | |||
private readonly teamStore: NedbDb) { | |||
} | |||
|
|||
storeUserActivity(matrixId: string, activity: UserActivity): Promise<void> { |
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.
Decided to give up on these completely since NeDB is already deprecated since a few versions ago.
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.
Looks good, a few concerns
config/config.sample-complete.yaml
Outdated
@@ -7,6 +7,9 @@ homeserver: | |||
|
|||
username_prefix: "slack_" | |||
|
|||
|
|||
RMAU_limit: 100 |
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.
We tend to go lowercase with these. I'm also wondering if we should have co-located it with the room limits, but it's probably a bit late for that now.
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 thought I was keeping it consistent with something, but apparently it was the exact opposite. Fixed in 121e102
src/Main.ts
Outdated
@@ -186,6 +214,10 @@ export class Main { | |||
controller: { | |||
onEvent: async(request) => { | |||
const ev = request.getData(); | |||
if (this.bridgeBlocker?.isBlocked) { |
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.
We might still want to handle admin commands
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.
Excluded in 27aa15a
src/Main.ts
Outdated
} | ||
|
||
async disableRtm() { | ||
await this.slackRtm?.disconnectAll().then(() => log.info("Disabled RTM")); |
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.
Ooi, why the then
? This should be identical?
await this.slackRtm?.disconnectAll().then(() => log.info("Disabled RTM")); | |
await this.slackRtm?.disconnectAll(); | |
log.info("Disabled RTM"); |
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.
The alternative would fire the log.info() even if slackRtm is undefined and thus not really disabled. It does look confusing though, an if
may be less concise but is probably more obvious. Will change it.
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 bc8a22e
} | ||
|
||
async blockBridge() { | ||
await this.slackBridge.disableHookHandler(); |
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.
Would add logs here
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 f085cff
} | ||
|
||
async unblockBridge() { | ||
if (this.slackBridge.config.rtm?.enable) { |
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.
And here
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 f085cff
This also disables activity tracking on NeDB (in addition to disabling bridge blocking). Hopefully NeDB goes away soon and this ugly path will not be needed for too long.
27aa15a
to
c8d6b02
Compare
Sister PR with matrix-org/matrix-appservice-irc#1472, based on matrix-org/matrix-appservice-bridge#350.
Drafting since I'm planning to move some code duplicated between -slack and -irc into bridge to reduce duplication.