Skip to content
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
Reset file list on upload in FilesPicker
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed May 11, 2023
commit 25c33acd5974865ff6c34845576366c60267eecb
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 @@ -66,7 +66,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 @@ -171,6 +171,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 @@ -53,10 +53,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