9090 {{ t('spreed','Create a new conversation') }}
9191 </NcActionButton >
9292
93+ <NcActionButton v-if =" !hasNoteToSelf"
94+ close-after-click
95+ @click =" restoreNoteToSelfConversation" >
96+ <template #icon >
97+ <Note :size =" 20" />
98+ </template >
99+ {{ t('spreed','New personal note') }}
100+ </NcActionButton >
101+
93102 <NcActionButton close-after-click
94103 @click =" showModalListConversations" >
95104 <template #icon >
@@ -239,6 +248,7 @@ import FilterIcon from 'vue-material-design-icons/Filter.vue'
239248import FilterRemoveIcon from ' vue-material-design-icons/FilterRemove.vue'
240249import List from ' vue-material-design-icons/FormatListBulleted.vue'
241250import MessageBadge from ' vue-material-design-icons/MessageBadge.vue'
251+ import Note from ' vue-material-design-icons/NoteEditOutline.vue'
242252import Plus from ' vue-material-design-icons/Plus.vue'
243253
244254import { showError } from ' @nextcloud/dialogs'
@@ -267,6 +277,7 @@ import { CONVERSATION } from '../../constants.js'
267277import BrowserStorage from ' ../../services/BrowserStorage.js'
268278import {
269279 createPrivateConversation ,
280+ fetchNoteToSelfConversation ,
270281 searchPossibleConversations ,
271282 searchListedConversations ,
272283} from ' ../../services/conversationsService.js'
@@ -303,6 +314,7 @@ export default {
303314 ChatPlus,
304315 List,
305316 DotsVertical,
317+ Note,
306318 },
307319
308320 mixins: [
@@ -396,6 +408,10 @@ export default {
396408 return this .searchText !== ' '
397409 },
398410
411+ hasNoteToSelf () {
412+ return this .conversationsList .find (conversation => conversation .type === CONVERSATION .TYPE .NOTE_TO_SELF )
413+ },
414+
399415 sourcesWithoutResults () {
400416 return ! this .searchResultsUsers .length
401417 || ! this .searchResultsGroups .length
@@ -616,9 +632,7 @@ export default {
616632 }
617633 },
618634
619- async createConversation (name ) {
620- const response = await createPrivateConversation (name)
621- const conversation = response .data .ocs .data
635+ switchToConversation (conversation ) {
622636 this .$store .dispatch (' addConversation' , conversation)
623637 this .abortSearch ()
624638 this .$router .push ({
@@ -627,6 +641,18 @@ export default {
627641 }).catch (err => console .debug (` Error while pushing the new conversation's route: ${ err} ` ))
628642 },
629643
644+ async createConversation (name ) {
645+ const response = await createPrivateConversation (name)
646+ const conversation = response .data .ocs .data
647+ this .switchToConversation (conversation)
648+ },
649+
650+ async restoreNoteToSelfConversation () {
651+ const response = await fetchNoteToSelfConversation ()
652+ const conversation = response .data .ocs .data
653+ this .switchToConversation (conversation)
654+ },
655+
630656 hasOneToOneConversationWith (userId ) {
631657 return !! this .conversationsList .find (conversation => conversation .type === CONVERSATION .TYPE .ONE_TO_ONE && conversation .name === userId)
632658 },
0 commit comments