Skip to content

Commit

Permalink
reload filelist when adding or removing shares
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
icewind1991 authored and backportbot-nextcloud[bot] committed May 31, 2023
1 parent 5eb2463 commit 4980fce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@
}
});

window._nc_event_bus.subscribe('files_sharing:share:created', () => { self.reload(true) });
window._nc_event_bus.subscribe('files_sharing:share:deleted', () => { self.reload(true) });

this.$fileList.on('click','td.filename>a.name, td.filesize, td.date', _.bind(this._onClickFile, this));

this.$fileList.on("droppedOnFavorites", function (event, file) {
Expand Down Expand Up @@ -2200,7 +2203,7 @@
*
* @return ajax call object
*/
reload: function() {
reload: function(keepOpen) {
this._selectedFiles = {};
this._selectionSummary.clear();
if (this._currentFileModel) {
Expand All @@ -2215,7 +2218,7 @@
properties: this._getWebdavProperties()
}
);
if (this._detailsView) {
if (this._detailsView && !keepOpen) {
// close sidebar
this._updateDetailsView(null);
}
Expand Down
6 changes: 5 additions & 1 deletion apps/files_sharing/src/mixins/ShareRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export default {
if (!request?.data?.ocs) {
throw request
}
return new Share(request.data.ocs.data)
const share = new Share(request.data.ocs.data)
emit('files_sharing:share:created', { share })
return share
} catch (error) {
console.error('Error while creating share', error)
const errorMessage = error?.response?.data?.ocs?.meta?.message
Expand All @@ -81,6 +83,7 @@ export default {
if (!request?.data?.ocs) {
throw request
}
emit('files_sharing:share:deleted', { id })
return true
} catch (error) {
console.error('Error while deleting share', error)
Expand All @@ -102,6 +105,7 @@ export default {
async updateShare(id, properties) {
try {
const request = await axios.put(shareUrl + `/${id}`, properties)
emit('files_sharing:share:updated', { id })
if (!request?.data?.ocs) {
throw request
} else {
Expand Down

0 comments on commit 4980fce

Please sign in to comment.