Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorMarco Ambrosini <marcoambrosini@pm.me>2021-07-22 16:14:22 +0300
committerMarco Ambrosini <marcoambrosini@pm.me>2021-07-23 07:47:53 +0300
commit509f2c1ad6275dca30485eb94a419b4e1ae0471f (patch)
tree1792ec895dbf68393398ac7816e8dff4d5a88c8f /src/store
parentc1dffb8ff30472b39c70b6676f3b3ad311e155c7 (diff)
Add ability to clear conversation history
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/conversationsStore.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js
index d31db4097..a4c9f0457 100644
--- a/src/store/conversationsStore.js
+++ b/src/store/conversationsStore.js
@@ -35,6 +35,7 @@ import {
setConversationName,
setConversationDescription,
deleteConversation,
+ clearConversationHistory,
setNotificationLevel,
} from '../services/conversationsService'
import { getCurrentUser } from '@nextcloud/auth'
@@ -197,6 +198,25 @@ const actions = {
},
/**
+ * Delete all the messages from a conversation.
+ *
+ * @param {object} context default store context;
+ * @param {object} token the token of the conversation whose history is
+ * to be cleared;
+ */
+ async clearConversationHistory(context, { token }) {
+ try {
+ const response = await clearConversationHistory(token)
+ context.dispatch('deleteMessages', token)
+ return response
+ } catch (error) {
+ console.debug(
+ t('spreed', 'Error while clearing conversation history'),
+ error)
+ }
+ },
+
+ /**
* Resets the store to it's original state.
* @param {object} context default store context;
*/