Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable21] Move remnants of ocs api requests to v2 endpoint #27109

Merged
merged 1 commit into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files/js/dist/personal-settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files/js/dist/personal-settings.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions apps/files/src/components/TransferOwnershipDialogue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {

this.loadingUsers = true
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: {
format: 'json',
itemType: 'file',
Expand All @@ -172,10 +172,6 @@ export default {
},
})

if (response.data.ocs.meta.statuscode !== 100) {
logger.error('Error fetching suggestions', { response })
}

this.userSuggestions = {}
response.data.ocs.data.exact.users.concat(response.data.ocs.data.users).forEach(user => {
Vue.set(this.userSuggestions, user.value.shareWith, {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js.map

Large diffs are not rendered by default.

52 changes: 27 additions & 25 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,20 @@ export default {
shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
}

const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
params: {
format: 'json',
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
search,
lookup,
perPage: this.config.maxAutocompleteResults,
shareType,
},
})

if (request.data.ocs.meta.statuscode !== 100) {
console.error('Error fetching suggestions', request)
let request = null
try {
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees', {
params: {
format: 'json',
itemType: this.fileInfo.type === 'dir' ? 'folder' : 'file',
search,
lookup,
perPage: this.config.maxAutocompleteResults,
shareType,
},
})
} catch (error) {
console.error('Error fetching suggestions', error)
return
}

Expand Down Expand Up @@ -283,24 +284,25 @@ export default {
async getRecommendations() {
this.loading = true

const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees_recommended', {
params: {
format: 'json',
itemType: this.fileInfo.type,
},
})

if (request.data.ocs.meta.statuscode !== 100) {
console.error('Error fetching recommendations', request)
let request = null
try {
request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'sharees_recommended', {
params: {
format: 'json',
itemType: this.fileInfo.type,
},
})
} catch (error) {
console.error('Error fetching recommendations', error)
return
}

// Add external results from the OCA.Sharing.ShareSearch api
const externalResults = this.externalResults.filter(result => !result.condition || result.condition(this))

const exact = request.data.ocs.data.exact

// 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
this.recommendations = this.filterOutExistingShares(rawRecommendations)
Expand Down