Skip to content

Commit 903b99b

Browse files
authored
Merge pull request #26466 from nextcloud/fix/ocs-api-v2
2 parents accfe5b + f1f8fa1 commit 903b99b

File tree

6 files changed

+34
-36
lines changed

6 files changed

+34
-36
lines changed

apps/files/js/dist/personal-settings.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files/js/dist/personal-settings.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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/js/dist/files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_sharing/js/dist/files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_sharing/src/components/SharingInput.vue

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,20 @@ export default {
197197
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
198198
}
199199
200-
const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
201-
params: {
202-
format: 'json',
203-
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
204-
search,
205-
lookup,
206-
perPage: this.config.maxAutocompleteResults,
207-
shareType,
208-
},
209-
})
210-
211-
if (request.data.ocs.meta.statuscode !== 100) {
212-
console.error('Error fetching suggestions', request)
200+
let request = null
201+
try {
202+
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees', {
203+
params: {
204+
format: 'json',
205+
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
206+
search,
207+
lookup,
208+
perPage: this.config.maxAutocompleteResults,
209+
shareType,
210+
},
211+
})
212+
} catch (error) {
213+
console.error('Error fetching suggestions', error)
213214
return
214215
}
215216
@@ -287,24 +288,25 @@ export default {
287288
async getRecommendations() {
288289
this.loading = true
289290
290-
const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees_recommended', {
291-
params: {
292-
format: 'json',
293-
itemType: this.fileInfo.type,
294-
},
295-
})
296-
297-
if (request.data.ocs.meta.statuscode !== 100) {
298-
console.error('Error fetching recommendations', request)
291+
let request = null
292+
try {
293+
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees_recommended', {
294+
params: {
295+
format: 'json',
296+
itemType: this.fileInfo.type,
297+
},
298+
})
299+
} catch (error) {
300+
console.error('Error fetching recommendations', error)
299301
return
300302
}
301303
304+
// Add external results from the OCA.Sharing.ShareSearch api
302305
const externalResults = this.externalResults.filter(result => !result.condition || result.condition(this))
303306
304-
const exact = request.data.ocs.data.exact
305-
306307
// flatten array of arrays
307-
const rawRecommendations = Object.values(exact).reduce((arr, elem) => arr.concat(elem), [])
308+
const rawRecommendations = Object.values(request.data.ocs.data.exact)
309+
.reduce((arr, elem) => arr.concat(elem), [])
308310
309311
// remove invalid data and format to user-select layout
310312
this.recommendations = this.filterOutExistingShares(rawRecommendations)

0 commit comments

Comments
 (0)