From ad734806f2d61983fa220d1b36497920f528025a Mon Sep 17 00:00:00 2001 From: Dorra Jaouad Date: Wed, 7 May 2025 10:51:47 +0200 Subject: [PATCH] fix(CalendarEvents): remove archive from options, implement expiring period as a capability and add an option to reset conversation to normal one without object attached. Signed-off-by: Dorra Jaouad --- .../Message/MessagePart/MessageBody.vue | 22 +++-- .../ConversationActionsShortcut.vue} | 97 +++++++++++++------ src/services/conversationsService.ts | 11 ++- src/store/conversationsStore.js | 12 +++ 4 files changed, 103 insertions(+), 39 deletions(-) rename src/components/{TopBar/CalendarEventConversationActions.vue => UIShared/ConversationActionsShortcut.vue} (51%) diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue index 220b80aae3..6476783693 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue @@ -26,8 +26,9 @@ - this.lastCallStartedMessageId }, diff --git a/src/components/TopBar/CalendarEventConversationActions.vue b/src/components/UIShared/ConversationActionsShortcut.vue similarity index 51% rename from src/components/TopBar/CalendarEventConversationActions.vue rename to src/components/UIShared/ConversationActionsShortcut.vue index 2c5f3740db..6a8a4bcd21 100644 --- a/src/components/TopBar/CalendarEventConversationActions.vue +++ b/src/components/UIShared/ConversationActionsShortcut.vue @@ -4,36 +4,60 @@ --> diff --git a/src/services/conversationsService.ts b/src/services/conversationsService.ts index e03040682d..6966d6f0d5 100644 --- a/src/services/conversationsService.ts +++ b/src/services/conversationsService.ts @@ -7,7 +7,6 @@ import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' import { hasTalkFeature } from './CapabilitiesManager.ts' -import { ATTENDEE, CONVERSATION } from '../constants.ts' import type { getAllConversationsParams, getAllConversationsResponse, @@ -19,6 +18,7 @@ import type { createConversationResponse, legacyCreateConversationParams, deleteConversationResponse, + unbindConversationFromObjectResponse, setConversationNameParams, setConversationNameResponse, setConversationPasswordParams, @@ -167,6 +167,14 @@ async function deleteConversation(token: string): deleteConversationResponse { return axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}', { token })) } +/** + * Detach a conversation from an object and it becomes a "normal" conversation. + * @param token The token of the conversation to be deleted. + */ +async function unbindConversationFromObject(token: string): unbindConversationFromObjectResponse { + return axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/object', { token })) +} + /** * Add a conversation to the favorites * @param token The token of the conversation to be favorites @@ -351,6 +359,7 @@ export { createLegacyConversation, createConversation, deleteConversation, + unbindConversationFromObject, addToFavorites, removeFromFavorites, archiveConversation, diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index e7018f91bf..a790d51e00 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -42,6 +42,7 @@ import { setConversationName, setConversationDescription, deleteConversation, + unbindConversationFromObject, setNotificationLevel, setNotificationCalls, setConversationPermissions, @@ -1231,6 +1232,17 @@ const actions = { showError(t('spreed', 'Could not delete the conversation picture')) } }, + + async unbindConversationFromObject(context, { token }) { + try { + const response = await unbindConversationFromObject(token) + const conversation = response.data.ocs.data + context.commit('addConversation', conversation) + } catch (error) { + console.error('Error while unbinding conversation from object: ', error) + showError(t('spreed', 'Could not remove the automatic expiration')) + } + } } export default { state, mutations, getters, actions }