|
|
|
@ -25,6 +25,7 @@
|
|
|
|
|
<!-- Editor -->
|
|
|
|
|
<Comment v-bind="editorData"
|
|
|
|
|
:auto-complete="autoComplete"
|
|
|
|
|
:user-data="userData"
|
|
|
|
|
:editor="true"
|
|
|
|
|
:ressource-id="ressourceId"
|
|
|
|
|
class="comments__writer"
|
|
|
|
@ -77,9 +78,9 @@ import Vue from 'vue'
|
|
|
|
|
|
|
|
|
|
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
|
|
|
|
|
|
|
|
|
|
import Comment from '../components/Comment'
|
|
|
|
|
import getComments, { DEFAULT_LIMIT } from '../services/GetComments'
|
|
|
|
|
import cancelableRequest from '../utils/cancelableRequest'
|
|
|
|
|
import Comment from '../components/Comment.vue'
|
|
|
|
|
import getComments, { DEFAULT_LIMIT } from '../services/GetComments.js'
|
|
|
|
|
import cancelableRequest from '../utils/cancelableRequest.js'
|
|
|
|
|
|
|
|
|
|
Vue.use(VTooltip)
|
|
|
|
|
|
|
|
|
@ -111,6 +112,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Comment,
|
|
|
|
|
userData: {},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -153,21 +155,22 @@ export default {
|
|
|
|
|
/**
|
|
|
|
|
* Make sure we have all mentions as Array of objects
|
|
|
|
|
* @param {Array} mentions the mentions list
|
|
|
|
|
* @returns {Object[]}
|
|
|
|
|
* @returns {Object<string, object>}
|
|
|
|
|
*/
|
|
|
|
|
genMentionsData(mentions) {
|
|
|
|
|
const list = Object.values(mentions).flat()
|
|
|
|
|
return list.reduce((mentions, mention) => {
|
|
|
|
|
mentions[mention.mentionId] = {
|
|
|
|
|
// TODO: support groups
|
|
|
|
|
icon: 'icon-user',
|
|
|
|
|
id: mention.mentionId,
|
|
|
|
|
label: mention.mentionDisplayName,
|
|
|
|
|
source: 'users',
|
|
|
|
|
primary: getCurrentUser().uid === mention.mentionId,
|
|
|
|
|
}
|
|
|
|
|
return mentions
|
|
|
|
|
}, {})
|
|
|
|
|
Object.values(mentions)
|
|
|
|
|
.flat()
|
|
|
|
|
.forEach(mention => {
|
|
|
|
|
this.userData[mention.mentionId] = {
|
|
|
|
|
// TODO: support groups
|
|
|
|
|
icon: 'icon-user',
|
|
|
|
|
id: mention.mentionId,
|
|
|
|
|
label: mention.mentionDisplayName,
|
|
|
|
|
source: 'users',
|
|
|
|
|
primary: getCurrentUser().uid === mention.mentionId,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return this.userData
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -230,7 +233,9 @@ export default {
|
|
|
|
|
limit: loadState('comments', 'maxAutoCompleteResults'),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
return callback(results.data.ocs.data)
|
|
|
|
|
// Save user data so it can be used by the editor to replace mentions
|
|
|
|
|
results.data.ocs.data.forEach(user => { this.userData[user.id] = user })
|
|
|
|
|
return callback(Object.values(this.userData))
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|