FEATURE: Stop hiding “allow archiving channels” setting

This commit is contained in:
Loïc Guitaut 2022-11-10 15:38:45 +01:00 committed by Loïc Guitaut
parent 040136675b
commit 3fd0423b1b
4 changed files with 25 additions and 3 deletions

View File

@ -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");
}

View File

@ -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."

View File

@ -48,7 +48,6 @@ chat:
min: 0
chat_allow_archiving_channels:
default: false
hidden: true
client: true
chat_archive_destination_topic_status:
type: enum

View File

@ -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;
});
});