Skip to content

Commit

Permalink
Merge pull request #1792 from nextcloud/backport/stable26/artonge/fix…
Browse files Browse the repository at this point in the history
…/refresh_file_list_on_upload

[stable26] Reset file list on upload in FilesPicker
  • Loading branch information
artonge authored May 16, 2023
2 parents fbd60d0 + 18e5fa5 commit 6553c1b
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_mixins_FetchFilesMixin_js.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_mixins_FetchFilesMixin_js.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_AlbumContent_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_AlbumContent_vue.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/components/FilesPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
:context="uploadContext"
:destination="photosLocation"
:multiple="true"
@uploaded="getFiles" />
@uploaded="refreshFiles" />
<NcButton type="primary" :disabled="loading || selectedFileIds.length === 0" @click="emitPickedEvent">
<template #icon>
<ImagePlus v-if="!loading" />
Expand Down Expand Up @@ -172,6 +172,10 @@ export default {
this.fetchFiles('', {}, this.blacklistIds)
},

refreshFiles() {
this.fetchFiles('', { firstResult: 0 }, [...this.blacklistIds, ...this.fetchedFileIds], true)
},

emitPickedEvent() {
this.$emit('files-picked', this.selectedFileIds)
},
Expand Down
5 changes: 3 additions & 2 deletions src/mixins/FetchFilesMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ export default {
* @param {string} path - Path to pass to getPhotos.
* @param {object} options - Options to pass to getPhotos.
* @param {string[]} [blacklist=[]] - Array of ids to filter out.
* @param {boolean} [force=false] - Force fetching even if doneFetchingFiles is true
* @return {Promise<string[]>} - The next batch of data depending on global offset.
*/
async fetchFiles(path = '', options = {}, blacklist = []) {
if (this.doneFetchingFiles || this.loadingFiles) {
async fetchFiles(path = '', options = {}, blacklist = [], force = false) {
if ((this.doneFetchingFiles && !force) || this.loadingFiles) {
return []
}

Expand Down

0 comments on commit 6553c1b

Please sign in to comment.