diff options
author | Marco Ambrosini <marcoambrosini@pm.me> | 2021-07-22 16:14:22 +0300 |
---|---|---|
committer | Marco Ambrosini <marcoambrosini@pm.me> | 2021-07-23 07:47:53 +0300 |
commit | 509f2c1ad6275dca30485eb94a419b4e1ae0471f (patch) | |
tree | 1792ec895dbf68393398ac7816e8dff4d5a88c8f /src/store | |
parent | c1dffb8ff30472b39c70b6676f3b3ad311e155c7 (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.js | 20 |
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; */ |