From 5073c4e1ba81d14bcc042dc52017570e374c3f73 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 5 Apr 2021 15:27:56 +0200 Subject: [PATCH] Can change group conversations visibility --- assets/js/components/groups/interface.js | 15 +++++++++++++++ assets/js/pages/groups/pages/settings.js | 16 ++++++++++++++++ .../sections/GroupConversationsSettings.html | 8 +++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/assets/js/components/groups/interface.js b/assets/js/components/groups/interface.js index 77c78e1a..d8d21574 100644 --- a/assets/js/components/groups/interface.js +++ b/assets/js/components/groups/interface.js @@ -134,6 +134,21 @@ const GroupsInterface = { }, true) }, + + /** + * Change group conversation visibility + * + * @param {Number} convID The ID of the conversation to delete + * @param {String} newLevel New minimal conversation visibility level + */ + changeGroupConversationVisibility: async function(convID, newLevel) { + await api("groups/set_conversation_visibility", { + conv_id: convID, + min_membership_level: newLevel + }, true) + }, + + /** * Delete a group conversation * diff --git a/assets/js/pages/groups/pages/settings.js b/assets/js/pages/groups/pages/settings.js index 2685e757..36d3a85c 100644 --- a/assets/js/pages/groups/pages/settings.js +++ b/assets/js/pages/groups/pages/settings.js @@ -381,6 +381,22 @@ const GroupSettingsPage = { } }, + /** + * Change conversation visibility + * + * @param {Conversation} conv Information about the target conversation + */ + changeVisibility: async function (conv) { + try { + await GroupsInterface.changeGroupConversationVisibility(conv.id, conv.group_min_membership_level); + } + + catch(e) { + console.error(e) + notify(tr("Failed to delete update conversation!"), "danger") + } + }, + /** * Delete a conversation */ diff --git a/assets/templates/pages/groups/sections/GroupConversationsSettings.html b/assets/templates/pages/groups/sections/GroupConversationsSettings.html index a07ecb99..5de73c5c 100644 --- a/assets/templates/pages/groups/sections/GroupConversationsSettings.html +++ b/assets/templates/pages/groups/sections/GroupConversationsSettings.html @@ -14,7 +14,13 @@ {{ conv.name }} - {{ conv.group_min_membership_level }} + + +