Skip to content

Commit a312323

Browse files
skjnldsvbackportbot[bot]
authored andcommitted
Move remnants of ocs api requests to v2 endpoint
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
1 parent 98cbf8a commit a312323

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

apps/files/src/components/TransferOwnershipDialogue.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export default {
162162
163163
this.loadingUsers = true
164164
try {
165-
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
165+
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees', {
166166
params: {
167167
format: 'json',
168168
itemType: 'file',
@@ -172,10 +172,6 @@ export default {
172172
},
173173
})
174174
175-
if (response.data.ocs.meta.statuscode !== 100) {
176-
logger.error('Error fetching suggestions', { response })
177-
}
178-
179175
this.userSuggestions = {}
180176
response.data.ocs.data.exact.users.concat(response.data.ocs.data.users).forEach(user => {
181177
Vue.set(this.userSuggestions, user.value.shareWith, {

apps/files_sharing/src/components/SharingInput.vue

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,20 @@ export default {
194194
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
195195
}
196196
197-
const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
198-
params: {
199-
format: 'json',
200-
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
201-
search,
202-
lookup,
203-
perPage: this.config.maxAutocompleteResults,
204-
shareType,
205-
},
206-
})
207-
208-
if (request.data.ocs.meta.statuscode !== 100) {
209-
console.error('Error fetching suggestions', request)
197+
let request = null
198+
try {
199+
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees', {
200+
params: {
201+
format: 'json',
202+
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
203+
search,
204+
lookup,
205+
perPage: this.config.maxAutocompleteResults,
206+
shareType,
207+
},
208+
})
209+
} catch (error) {
210+
console.error('Error fetching suggestions', error)
210211
return
211212
}
212213
@@ -283,24 +284,25 @@ export default {
283284
async getRecommendations() {
284285
this.loading = true
285286
286-
const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees_recommended', {
287-
params: {
288-
format: 'json',
289-
itemType: this.fileInfo.type,
290-
},
291-
})
292-
293-
if (request.data.ocs.meta.statuscode !== 100) {
294-
console.error('Error fetching recommendations', request)
287+
let request = null
288+
try {
289+
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees_recommended', {
290+
params: {
291+
format: 'json',
292+
itemType: this.fileInfo.type,
293+
},
294+
})
295+
} catch (error) {
296+
console.error('Error fetching recommendations', error)
295297
return
296298
}
297299
300+
// Add external results from the OCA.Sharing.ShareSearch api
298301
const externalResults = this.externalResults.filter(result => !result.condition || result.condition(this))
299302
300-
const exact = request.data.ocs.data.exact
301-
302303
// flatten array of arrays
303-
const rawRecommendations = Object.values(exact).reduce((arr, elem) => arr.concat(elem), [])
304+
const rawRecommendations = Object.values(request.data.ocs.data.exact)
305+
.reduce((arr, elem) => arr.concat(elem), [])
304306
305307
// remove invalid data and format to user-select layout
306308
this.recommendations = this.filterOutExistingShares(rawRecommendations)

0 commit comments

Comments
 (0)