Skip to content
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

optionally make users wait to join bridged rooms #1645

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

jesopo
Copy link

@jesopo jesopo commented Nov 2, 2022

couple of TODOs still; looking for feedback on if i'm going in the right direction

@jesopo
Copy link
Author

jesopo commented Nov 2, 2022

a more ideal future here would be one involving knocking, i.e. 60 minutes after you knock, you are invited, or something like that.

Copy link

@Yoric Yoric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you mentioned, inviting people would probably make for better UX.

Is there a way to:

  1. First time the user knocks, send them a message along the lines of "For user safety, this bridge is configured with a join delay. You will be allowed to join on ${date}."
  2. After this delay, send an invite.

Maybe?

@jesopo
Copy link
Author

jesopo commented Nov 3, 2022

I don't believe knocking is widely implemented yet

@Yoric
Copy link

Yoric commented Nov 3, 2022

I don't believe knocking is widely implemented yet

Sorry, I shouldn't have written "knocks" but rather "attempts to join".

src/datastore/DataStore.ts Outdated Show resolved Hide resolved
@jesopo jesopo marked this pull request as ready for review November 10, 2022 13:49
@jesopo jesopo requested a review from a team as a code owner November 10, 2022 13:49
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promising stuff, I've got some suggestions.

@@ -1072,8 +1072,13 @@ export class IrcBridge {
if (userIds) {
for (const userId of userIds) {
this.activityTracker.setLastActiveTime(userId);
this.dataStore.updateLastSeenTimeForUser(userId).catch((ex) => {
log.warn(`Failed to bump last active time for ${userId} in database`, ex);
this.dataStore.getFirstSeenTimeForUser(userId).then((when) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this it's own function inside datastore personally, and have the logic for setting first seen time handled within. We might even be able to wrap the postgres stuff into one statement.

user.getId(),
req,
true,
`Please wait ${remaining} seconds`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to let the user know why they are waiting :). Either a message to their admin room, or a link to a page.

@@ -66,6 +66,10 @@ export interface BridgeConfig {
inactiveAfterDays?: number;
};
banLists?: MatrixBanSyncConfig;
delayBridging?: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these need more descriptions about what they do. It might even make sense to have this go under the membershipLists configuration where we configure Matrix joins.

We should certainly make it obvious that these are seconds.

src/datastore/NedbDataStore.ts Show resolved Hide resolved
ALTER TABLE last_seen ADD COLUMN first BIGINT;
ALTER TABLE last_seen RENAME COLUMN ts TO last;
UPDATE last_seen SET first = last;
ALTER TABLE last_seen ALTER COLUMN first SET NOT NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might explode for all the existing items that don't have a value set.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the line above it; we backfill first from last

src/bridge/MatrixHandler.ts Outdated Show resolved Hide resolved
@Half-Shot Half-Shot self-requested a review December 5, 2022 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants