Move remnants of ocs api requests to v2 endpoint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
accfe5b82d
commit
f1f8fa1e99
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -162,7 +162,7 @@ export default {
|
||||||
|
|
||||||
this.loadingUsers = true
|
this.loadingUsers = true
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
|
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees', {
|
||||||
params: {
|
params: {
|
||||||
format: 'json',
|
format: 'json',
|
||||||
itemType: 'file',
|
itemType: 'file',
|
||||||
|
@ -172,10 +172,6 @@ export default {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (response.data.ocs.meta.statuscode !== 100) {
|
|
||||||
logger.error('Error fetching suggestions', { response })
|
|
||||||
}
|
|
||||||
|
|
||||||
this.userSuggestions = {}
|
this.userSuggestions = {}
|
||||||
response.data.ocs.data.exact.users.concat(response.data.ocs.data.users).forEach(user => {
|
response.data.ocs.data.exact.users.concat(response.data.ocs.data.users).forEach(user => {
|
||||||
Vue.set(this.userSuggestions, user.value.shareWith, {
|
Vue.set(this.userSuggestions, user.value.shareWith, {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -197,19 +197,20 @@ export default {
|
||||||
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
|
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
|
let request = null
|
||||||
params: {
|
try {
|
||||||
format: 'json',
|
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees', {
|
||||||
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
|
params: {
|
||||||
search,
|
format: 'json',
|
||||||
lookup,
|
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
|
||||||
perPage: this.config.maxAutocompleteResults,
|
search,
|
||||||
shareType,
|
lookup,
|
||||||
},
|
perPage: this.config.maxAutocompleteResults,
|
||||||
})
|
shareType,
|
||||||
|
},
|
||||||
if (request.data.ocs.meta.statuscode !== 100) {
|
})
|
||||||
console.error('Error fetching suggestions', request)
|
} catch (error) {
|
||||||
|
console.error('Error fetching suggestions', error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,24 +288,25 @@ export default {
|
||||||
async getRecommendations() {
|
async getRecommendations() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
||||||
const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees_recommended', {
|
let request = null
|
||||||
params: {
|
try {
|
||||||
format: 'json',
|
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees_recommended', {
|
||||||
itemType: this.fileInfo.type,
|
params: {
|
||||||
},
|
format: 'json',
|
||||||
})
|
itemType: this.fileInfo.type,
|
||||||
|
},
|
||||||
if (request.data.ocs.meta.statuscode !== 100) {
|
})
|
||||||
console.error('Error fetching recommendations', request)
|
} catch (error) {
|
||||||
|
console.error('Error fetching recommendations', error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add external results from the OCA.Sharing.ShareSearch api
|
||||||
const externalResults = this.externalResults.filter(result => !result.condition || result.condition(this))
|
const externalResults = this.externalResults.filter(result => !result.condition || result.condition(this))
|
||||||
|
|
||||||
const exact = request.data.ocs.data.exact
|
|
||||||
|
|
||||||
// flatten array of arrays
|
// flatten array of arrays
|
||||||
const rawRecommendations = Object.values(exact).reduce((arr, elem) => arr.concat(elem), [])
|
const rawRecommendations = Object.values(request.data.ocs.data.exact)
|
||||||
|
.reduce((arr, elem) => arr.concat(elem), [])
|
||||||
|
|
||||||
// remove invalid data and format to user-select layout
|
// remove invalid data and format to user-select layout
|
||||||
this.recommendations = this.filterOutExistingShares(rawRecommendations)
|
this.recommendations = this.filterOutExistingShares(rawRecommendations)
|
||||||
|
|
Loading…
Reference in New Issue