Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Stop hiding “allow archiving channels” setting

Loïc Guitaut3fd0423b1b01
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js b/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js
index a453ad360fe..4de9c91b2c8 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js
@@ -1,6 +1,6 @@
import { INPUT_DELAY } from "discourse-common/config/environment";
import Component from "@ember/component";
-import { action } from "@ember/object";
+import { action, computed } from "@ember/object";
import { tracked } from "@glimmer/tracking";
import { inject as service } from "@ember/service";
import ChatApi from "discourse/plugins/chat/discourse/lib/chat-api";
@@ -17,7 +17,6 @@ export default class ChatBrowseView extends Component {
@tracked channels = [];
tagName = "";
- tabs = TABS;
offset = 0;
canLoadMore = true;
@@ -59,6 +58,15 @@ export default class ChatBrowseView extends Component {
}
}
+ @computed("siteSettings.chat_allow_archiving_channels")
+ get tabs() {
+ if (this.siteSettings.chat_allow_archiving_channels) {
+ return TABS;
+ } else {
+ return [...TABS].removeObject("archived");
+ }
+ }
+
get chatProgressBarContainer() {
return document.querySelector("#chat-progress-bar-container");
}
diff --git a/plugins/chat/config/locales/server.en.yml b/plugins/chat/config/locales/server.en.yml
index ce78276f865..90bce726dc8 100644
--- a/plugins/chat/config/locales/server.en.yml
+++ b/plugins/chat/config/locales/server.en.yml
@@ -18,6 +18,7 @@ en:
direct_message_enabled_groups: "Allow users within these groups to create user-to-user Personal Chats. Note: staff can always create Personal Chats, and users will be able to reply to Personal Chats initiated by users who have permission to create them."
chat_message_flag_allowed_groups: "Users in these groups are allowed to flag chat messages."
chat_max_direct_message_users: "Users cannot add more than this number of other users when creating a new direct message. Set to 0 to only allow messages to oneself. Staff are exempt from this setting."
+ chat_allow_archiving_channels: "Allow staff to archive messages to a topic when closing a channel."
errors:
chat_default_channel: "The default chat channel must be a public channel."
direct_message_enabled_groups_invalid: "You must specify at least one group for this setting. If you do not want anyone except staff to send direct messages, choose the staff group."
diff --git a/plugins/chat/config/settings.yml b/plugins/chat/config/settings.yml
index feeb0f34421..405d1f43a8e 100644
--- a/plugins/chat/config/settings.yml
+++ b/plugins/chat/config/settings.yml
@@ -48,7 +48,6 @@ chat:
min: 0
chat_allow_archiving_channels:
default: false
- hidden: true
client: true
chat_archive_destination_topic_status:
type: enum
diff --git a/plugins/chat/test/javascripts/acceptance/chat-browse-test.js b/plugins/chat/test/javascripts/acceptance/chat-browse-test.js
index 6f8916a2de6..87e91f21762 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-browse-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-browse-test.js
@@ -82,6 +82,8 @@ acceptance("Discourse Chat - browse channels", function (needs) {
});
test("Archived filter", async function (assert) {
+ this.siteSettings.chat_allow_archiving_channels = true;
+
await visit("/chat/browse");
await click(".chat-browse-view__filter-link.-archived");
@@ -108,4 +110,16 @@ acceptance("Discourse Chat - browse channels", function (needs) {
I18n.t("chat.empty_state.title")
);
});
+
+ test("Archiving channels is not allowed", async function (assert) {
+ this.siteSettings.chat_allow_archiving_channels = false;
+
+ await visit("/chat/browse");
+
+ assert.equal(
+ queryAll(".chat-browse-view__filter-link.-archived").length,
+ 0
+ );
+ this.siteSettings.chat_allow_archiving_channels = true;
+ });
});