From ac22b14358c202fa5a09a3b84e4dd6ee0692d254 Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Sat, 14 Apr 2018 17:01:25 +0100 Subject: [PATCH] Add opening channel/guild settings window --- client/src/modules/discordapi.js | 2 ++ client/src/modules/webpackmodules.js | 7 ++++++- client/src/structs/discord/channel.js | 9 +++++++++ client/src/structs/discord/guild.js | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/client/src/modules/discordapi.js b/client/src/modules/discordapi.js index 4e538a9d..0ca332ce 100644 --- a/client/src/modules/discordapi.js +++ b/client/src/modules/discordapi.js @@ -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; } }; diff --git a/client/src/modules/webpackmodules.js b/client/src/modules/webpackmodules.js index 59bcf371..5862ba1d 100644 --- a/client/src/modules/webpackmodules.js +++ b/client/src/modules/webpackmodules.js @@ -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 } + } diff --git a/client/src/structs/discord/channel.js b/client/src/structs/discord/channel.js index 6ad80346..bb2b1a00 100644 --- a/client/src/structs/discord/channel.js +++ b/client/src/structs/discord/channel.js @@ -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 { diff --git a/client/src/structs/discord/guild.js b/client/src/structs/discord/guild.js index d1797b62..1988a107 100644 --- a/client/src/structs/discord/guild.js +++ b/client/src/structs/discord/guild.js @@ -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); }