From 0b2e981f85b673a42ceffe00b5fc2638d3d56713 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Fri, 20 Sep 2024 13:13:37 +0200 Subject: [PATCH 1/3] feat: add handling of archived conversations Signed-off-by: Maksim Sukharev --- src/__mocks__/capabilities.ts | 2 ++ .../ConversationSettingsDialog.vue | 27 +++++++++++++++-- .../ConversationsList/Conversation.vue | 30 ++++++++++++++++++- src/services/conversationsService.js | 20 +++++++++++++ src/store/conversationsStore.js | 20 ++++++++++++- 5 files changed, 95 insertions(+), 4 deletions(-) diff --git a/src/__mocks__/capabilities.ts b/src/__mocks__/capabilities.ts index 4a57bd1482a..fd20965f8c3 100644 --- a/src/__mocks__/capabilities.ts +++ b/src/__mocks__/capabilities.ts @@ -84,6 +84,7 @@ export const mockedCapabilities: Capabilities = { 'chat-reference-id', 'mention-permissions', 'edit-messages-note-to-self', + 'archived-conversations', ], 'features-local': [ 'favorites', @@ -95,6 +96,7 @@ export const mockedCapabilities: Capabilities = { 'avatar', 'remind-me-later', 'note-to-self', + 'archived-conversations', ], config: { attachments: { diff --git a/src/components/ConversationSettings/ConversationSettingsDialog.vue b/src/components/ConversationSettings/ConversationSettingsDialog.vue index 07e1498d75a..ec0f6a2fb8e 100644 --- a/src/components/ConversationSettings/ConversationSettingsDialog.vue +++ b/src/components/ConversationSettings/ConversationSettingsDialog.vue @@ -84,6 +84,16 @@ id="dangerzone" :name="t('spreed', 'Danger zone')"> + @@ -122,6 +132,8 @@ import { CALL, CONFIG, PARTICIPANT, CONVERSATION } from '../../constants.js' import { getTalkConfig, hasTalkFeature } from '../../services/CapabilitiesManager.ts' import { useSettingsStore } from '../../stores/settings.js' +const supportsArchive = hasTalkFeature('local', 'archived-conversations') + export default { name: 'ConversationSettingsDialog', @@ -149,7 +161,10 @@ export default { setup() { const settingsStore = useSettingsStore() - return { settingsStore } + return { + supportsArchive, + settingsStore, + } }, data() { @@ -201,6 +216,10 @@ export default { return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation }, + isArchived() { + return this.conversation.isArchived + }, + participantType() { return this.conversation.participantType }, @@ -273,7 +292,11 @@ export default { setShowMediaSettings(newValue) { this.settingsStore.setShowMediaSettings(this.token, newValue) - } + }, + + async toggleArchiveConversation() { + await this.$store.dispatch('toggleArchive', this.conversation) + }, }, } diff --git a/src/components/LeftSidebar/ConversationsList/Conversation.vue b/src/components/LeftSidebar/ConversationsList/Conversation.vue index b87ab7fac08..cf6648684bb 100644 --- a/src/components/LeftSidebar/ConversationsList/Conversation.vue +++ b/src/components/LeftSidebar/ConversationsList/Conversation.vue @@ -57,6 +57,17 @@ {{ t('spreed', 'Conversation settings') }} + + + {{ labelArchive }} + + Date: Tue, 24 Sep 2024 13:08:53 +0200 Subject: [PATCH 2/3] feat: handle leave conversation via dialog Signed-off-by: Maksim Sukharev --- .../ConversationSettings/DangerZone.vue | 75 ++++++- .../ConversationsList/Conversation.spec.js | 200 +++++++++--------- .../ConversationsList/Conversation.vue | 61 ++++-- 3 files changed, 215 insertions(+), 121 deletions(-) diff --git a/src/components/ConversationSettings/DangerZone.vue b/src/components/ConversationSettings/DangerZone.vue index e86d40163ec..c366c1df976 100644 --- a/src/components/ConversationSettings/DangerZone.vue +++ b/src/components/ConversationSettings/DangerZone.vue @@ -11,18 +11,40 @@

{{ t('spreed', 'Leave conversation') }}

-

+

{{ t('spreed', 'Once a conversation is left, to rejoin a closed conversation, an invite is needed. An open conversation can be rejoined at any time.') }}

- + {{ t('spreed', 'Leave conversation') }} + + + +

{{ t('spreed', 'Delete conversation') }}

-

+

{{ t('spreed', 'Permanently delete this conversation.') }}

{{ t('spreed', 'Delete chat messages') }} -

+

{{ t('spreed', 'Permanently delete all the messages in this conversation.') }}