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

Allow membership sync to be disabled in team sync #27

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/TeamSyncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface ITeamSyncConfig {
alias_prefix?: string;
allow_private?: boolean;
allow_public?: boolean;
allow_membership_sync?: boolean;
hint_channel_admins?: boolean;
};
users?: {
Expand Down Expand Up @@ -78,6 +79,9 @@ export class TeamSyncer {
if (!teamConfig.channels.allow_public && !teamConfig.channels.allow_private) {
throw Error('At least one of allow_public, allow_private must be true in the teamSync config');
}
if (teamConfig.channels.allow_membership_sync === undefined) {
teamConfig.channels.allow_membership_sync = true;
}
// Send hint to channel admins
teamConfig.channels.hint_channel_admins =
teamConfig.channels.hint_channel_admins === undefined
Expand Down Expand Up @@ -433,6 +437,14 @@ export class TeamSyncer {
throw Error("Could not find team");
}

const config: false | ITeamSyncConfig = this.getTeamSyncConfig(teamId,"channel");
if (config) {
if (config.channels?.allow_membership_sync === false) {
log.info("Skipping membership sync because disabled in config");
return;
}
}

// create Set for both matrix membership state and slack membership state
// compare them to figure out who all needs to join the matrix room and leave the matrix room
// this obviously assumes we treat slack as the source of truth for membership
Expand Down
Loading