diff --git a/package.json b/package.json index 8debbbfa5..6ec9b9fc6 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "dompurify": "^2.0.8", "markdown-it": "^10.0.0", "markdown-it-task-lists": "^2.1.1", + "lodash": "^4.17.15", "moment": "^2.24.0", "nextcloud-vue-collections": "^0.7.2", "p-queue": "^6.3.0", diff --git a/src/components/board/SharingTabSidebar.vue b/src/components/board/SharingTabSidebar.vue index 7fd82d148..0f7bdeebb 100644 --- a/src/components/board/SharingTabSidebar.vue +++ b/src/components/board/SharingTabSidebar.vue @@ -132,10 +132,13 @@ export default { }) }, }, + mounted() { + this.asyncFind('') + }, methods: { asyncFind(query) { this.isLoading = true - this.$store.dispatch('loadSharees').then(response => { + this.$store.dispatch('loadSharees', query).then(response => { this.isLoading = false }) }, diff --git a/src/store/main.js b/src/store/main.js index 3339ad5e4..ed7f1baf9 100644 --- a/src/store/main.js +++ b/src/store/main.js @@ -31,7 +31,7 @@ import card from './card' import comment from './comment' import trashbin from './trashbin' import attachment from './attachment' - +import debounce from 'lodash/debounce' Vue.use(Vuex) const apiClient = new BoardApi() @@ -181,7 +181,11 @@ export default new Vuex.Store({ state.boards = boards }, setSharees(state, shareesUsersAndGroups) { - state.sharees = shareesUsersAndGroups.users + state.sharees = shareesUsersAndGroups.exact.users + state.sharees.push(...shareesUsersAndGroups.exact.groups) + state.sharees.push(...shareesUsersAndGroups.exact.circles) + + state.sharees.push(...shareesUsersAndGroups.users) state.sharees.push(...shareesUsersAndGroups.groups) state.sharees.push(...shareesUsersAndGroups.circles) }, @@ -328,16 +332,20 @@ export default new Vuex.Store({ const boards = await apiClient.loadBoards() commit('setBoards', boards) }, - loadSharees({ commit }) { + loadSharees: debounce(function({ commit }, query) { const params = new URLSearchParams() + if (typeof query === 'undefined') { + return + } + params.append('search', query) params.append('format', 'json') - params.append('perPage', 4) - params.append('itemType', 0) - params.append('itemType', 1) + params.append('perPage', 20) + params.append('itemType', [0, 1, 7]) + axios.get(OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees', { params }).then((response) => { commit('setSharees', response.data.ocs.data) }) - }, + }, 250), setBoardFilter({ commmit }, filter) { commmit('setBoardFilter', filter)