Merge pull request #1726 from nextcloud/bugfix/sharing-search

This commit is contained in:
Julius Härtl
2020-04-21 09:56:04 +02:00
committed by GitHub
3 changed files with 20 additions and 8 deletions

View File

@@ -42,6 +42,7 @@
"dompurify": "^2.0.8", "dompurify": "^2.0.8",
"markdown-it": "^10.0.0", "markdown-it": "^10.0.0",
"markdown-it-task-lists": "^2.1.1", "markdown-it-task-lists": "^2.1.1",
"lodash": "^4.17.15",
"moment": "^2.24.0", "moment": "^2.24.0",
"nextcloud-vue-collections": "^0.7.2", "nextcloud-vue-collections": "^0.7.2",
"p-queue": "^6.3.0", "p-queue": "^6.3.0",

View File

@@ -132,10 +132,13 @@ export default {
}) })
}, },
}, },
mounted() {
this.asyncFind('')
},
methods: { methods: {
asyncFind(query) { asyncFind(query) {
this.isLoading = true this.isLoading = true
this.$store.dispatch('loadSharees').then(response => { this.$store.dispatch('loadSharees', query).then(response => {
this.isLoading = false this.isLoading = false
}) })
}, },

View File

@@ -31,7 +31,7 @@ import card from './card'
import comment from './comment' import comment from './comment'
import trashbin from './trashbin' import trashbin from './trashbin'
import attachment from './attachment' import attachment from './attachment'
import debounce from 'lodash/debounce'
Vue.use(Vuex) Vue.use(Vuex)
const apiClient = new BoardApi() const apiClient = new BoardApi()
@@ -181,7 +181,11 @@ export default new Vuex.Store({
state.boards = boards state.boards = boards
}, },
setSharees(state, shareesUsersAndGroups) { 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.groups)
state.sharees.push(...shareesUsersAndGroups.circles) state.sharees.push(...shareesUsersAndGroups.circles)
}, },
@@ -328,16 +332,20 @@ export default new Vuex.Store({
const boards = await apiClient.loadBoards() const boards = await apiClient.loadBoards()
commit('setBoards', boards) commit('setBoards', boards)
}, },
loadSharees({ commit }) { loadSharees: debounce(function({ commit }, query) {
const params = new URLSearchParams() const params = new URLSearchParams()
if (typeof query === 'undefined') {
return
}
params.append('search', query)
params.append('format', 'json') params.append('format', 'json')
params.append('perPage', 4) params.append('perPage', 20)
params.append('itemType', 0) params.append('itemType', [0, 1, 7])
params.append('itemType', 1)
axios.get(OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees', { params }).then((response) => { axios.get(OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees', { params }).then((response) => {
commit('setSharees', response.data.ocs.data) commit('setSharees', response.data.ocs.data)
}) })
}, }, 250),
setBoardFilter({ commmit }, filter) { setBoardFilter({ commmit }, filter) {
commmit('setBoardFilter', filter) commmit('setBoardFilter', filter)