Skip to content

Commit 130c8f2

Browse files
reload filelist when adding or removing shares
Signed-off-by: Robin Appelman <robin@icewind.nl> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent 05d9937 commit 130c8f2

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

apps/files/js/filelist.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@
383383
}
384384
});
385385

386+
window._nc_event_bus.subscribe('files_sharing:share:created', () => { self.reload(true) });
387+
window._nc_event_bus.subscribe('files_sharing:share:deleted', () => { self.reload(true) });
388+
386389
this.$fileList.on('click','td.filename>a.name, td.filesize, td.date', _.bind(this._onClickFile, this));
387390

388391
this.$fileList.on("droppedOnFavorites", function (event, file) {
@@ -2199,7 +2202,7 @@
21992202
*
22002203
* @return ajax call object
22012204
*/
2202-
reload: function() {
2205+
reload: function(keepOpen) {
22032206
this._selectedFiles = {};
22042207
this._selectionSummary.clear();
22052208
if (this._currentFileModel) {
@@ -2214,7 +2217,7 @@
22142217
properties: this._getWebdavProperties()
22152218
}
22162219
);
2217-
if (this._detailsView) {
2220+
if (this._detailsView && !keepOpen) {
22182221
// close sidebar
22192222
this._updateDetailsView(null);
22202223
}

apps/files_sharing/src/mixins/ShareRequests.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ export default {
5757
if (!request?.data?.ocs) {
5858
throw request
5959
}
60-
return new Share(request.data.ocs.data)
60+
const share = new Share(request.data.ocs.data)
61+
emit('files_sharing:share:created', { share })
62+
return share
6163
} catch (error) {
6264
console.error('Error while creating share', error)
6365
const errorMessage = error?.response?.data?.ocs?.meta?.message
@@ -81,6 +83,7 @@ export default {
8183
if (!request?.data?.ocs) {
8284
throw request
8385
}
86+
emit('files_sharing:share:deleted', { id })
8487
return true
8588
} catch (error) {
8689
console.error('Error while deleting share', error)
@@ -102,6 +105,7 @@ export default {
102105
async updateShare(id, properties) {
103106
try {
104107
const request = await axios.put(shareUrl + `/${id}`, properties)
108+
emit('files_sharing:share:updated', { id })
105109
if (!request?.data?.ocs) {
106110
throw request
107111
} else {

0 commit comments

Comments
 (0)