Add opening channel/guild settings window

This commit is contained in:
Samuel Elliott 2018-04-14 17:01:25 +01:00
parent 4d5a403d6d
commit ac22b14358
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
4 changed files with 26 additions and 1 deletions

View File

@ -36,6 +36,8 @@ export const Modules = {
get UserSettingsStore() { return this._getModule('UserSettingsStore'); },
get UserSettingsWindow() { return this._getModule('UserSettingsWindow'); },
get UserStatusStore() { return this._getModule('UserStatusStore'); },
get ChannelSettingsWindow() { return this._getModule('ChannelSettingsWindow'); },
get GuildSettingsWindow() { return this._getModule('GuildSettingsWindow'); },
get DiscordPermissions() { return this.DiscordConstants.Permissions; }
};

View File

@ -181,8 +181,10 @@ const KnownModules = {
/* DOM/React Components */
/* ==================== */
UserSettingsWindow: Filters.byProperties(['open', 'updateAccount']),
LayerManager: Filters.byProperties(['popLayer', 'pushLayer']),
UserSettingsWindow: Filters.byProperties(['open', 'updateAccount']),
ChannelSettingsWindow: Filters.byProperties(['open', 'updateChannel']),
GuildSettingsWindow: Filters.byProperties(['open', 'updateGuild']),
/* Modals */
ModalStack: Filters.byProperties(['push', 'update', 'pop', 'popWithKey']),
@ -313,4 +315,7 @@ export class WebpackModules {
return Object.keys(KnownModules);
}
static get Filters() { return Filters }
static get KnownModules() { return KnownModules }
}

View File

@ -99,6 +99,15 @@ export class Channel {
Modules.NavigationUtils.transitionToGuild(this.guild_id ? this.guild_id : Modules.DiscordConstants.ME, this.id);
}
/**
* Opens this channel's settings window.
* @param {String} section The section to open (see DiscordConstants.ChannelSettingsSections)
*/
openSettings(section = 'OVERVIEW') {
Modules.ChannelSettingsWindow.open(this.id);
Modules.ChannelSettingsWindow.setSection(section);
}
}
export class PermissionOverwrite {

View File

@ -173,6 +173,15 @@ export class Guild {
Modules.GuildActions.selectGuild(this.id);
}
/**
* Opens this guild's settings window.
* @param {String} section The section to open (see DiscordConstants.GuildSettingsSections)
*/
openSettings(section = 'OVERVIEW') {
Modules.GuildSettingsWindow.open(this.id);
Modules.GuildSettingsWindow.setSection(section);
}
nsfwAgree() {
Modules.GuildActions.nsfwAgree(this.id);
}