From 7e39a21de1c6794ee0c225be9cda6249cb1a55ea Mon Sep 17 00:00:00 2001 From: chapoi <101828855+chapoi@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:10:42 +0100 Subject: [PATCH] UX: redesign of chat settings + add chat retention info (#19017) * UX: redesign of chat settings --- .../jobs/regular/auto_join_channel_batch.rb | 1 + .../auto_manage_channel_memberships.rb | 1 + .../components/chat-channel-settings-view.js | 15 ++++++++++- .../components/chat-channel-settings-view.hbs | 13 +++++----- .../stylesheets/common/chat-channel-info.scss | 3 ++- .../assets/stylesheets/common/chat-form.scss | 25 ++++++++++++++++--- .../assets/stylesheets/desktop/desktop.scss | 6 +++++ plugins/chat/config/locales/client.en.yml | 8 ++++-- 8 files changed, 59 insertions(+), 13 deletions(-) diff --git a/plugins/chat/app/jobs/regular/auto_join_channel_batch.rb b/plugins/chat/app/jobs/regular/auto_join_channel_batch.rb index a4a11270de7..16d01e96a94 100644 --- a/plugins/chat/app/jobs/regular/auto_join_channel_batch.rb +++ b/plugins/chat/app/jobs/regular/auto_join_channel_batch.rb @@ -1,3 +1,4 @@ +# NOTE: When changing auto-join logic, make sure to update the `settings.auto_join_users_info` translation as well. # frozen_string_literal: true module Jobs diff --git a/plugins/chat/app/jobs/regular/auto_manage_channel_memberships.rb b/plugins/chat/app/jobs/regular/auto_manage_channel_memberships.rb index 6d579bc88ef..9785db5c920 100644 --- a/plugins/chat/app/jobs/regular/auto_manage_channel_memberships.rb +++ b/plugins/chat/app/jobs/regular/auto_manage_channel_memberships.rb @@ -1,3 +1,4 @@ +# NOTE: When changing auto-join logic, make sure to update the `settings.auto_join_users_info` translation as well. # frozen_string_literal: true module Jobs diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings-view.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings-view.js index 8ca9eda17af..7c5fd6bdb2a 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings-view.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings-view.js @@ -18,6 +18,11 @@ const MUTED_OPTIONS = [ { name: I18n.t("chat.settings.muted_off"), value: false }, ]; +const AUTO_ADD_USERS_OPTIONS = [ + { name: I18n.t("chat.settings.enable_auto_join_users"), value: true }, + { name: I18n.t("chat.settings.disable_auto_join_users"), value: false }, +]; + export default class ChatChannelSettingsView extends Component { @service chat; @service router; @@ -27,6 +32,7 @@ export default class ChatChannelSettingsView extends Component { notificationLevels = NOTIFICATION_LEVELS; mutedOptions = MUTED_OPTIONS; + autoAddUsersOptions = AUTO_ADD_USERS_OPTIONS; isSavingNotificationSetting = false; savedDesktopNotificationLevel = false; savedMobileNotificationLevel = false; @@ -119,11 +125,18 @@ export default class ChatChannelSettingsView extends Component { } @action + onToggleAutoJoinUsers() { + if (!this.channel.auto_join_users) { + this.onEnableAutoJoinUsers(); + } else { + this.onDisableAutoJoinUsers(); + } + } + onDisableAutoJoinUsers() { this._updateAutoJoinUsers(false); } - @action onEnableAutoJoinUsers() { this.dialog.confirm({ message: I18n.t("chat.settings.auto_join_users_warning", { diff --git a/plugins/chat/assets/javascripts/discourse/templates/components/chat-channel-settings-view.hbs b/plugins/chat/assets/javascripts/discourse/templates/components/chat-channel-settings-view.hbs index 875e816ec05..39b46b4091a 100644 --- a/plugins/chat/assets/javascripts/discourse/templates/components/chat-channel-settings-view.hbs +++ b/plugins/chat/assets/javascripts/discourse/templates/components/chat-channel-settings-view.hbs @@ -12,7 +12,6 @@ {{/if}} - {{#unless this.channel.current_user_membership.muted}}