summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-06-17 08:14:24 +0200
committerGitHub <noreply@github.com>2023-06-17 08:14:24 +0200
commita87ecd1a4f68f10d280432ae13006bbc0a781f1b (patch)
treef648fdffaece03179166dfa69479633509a4e536 /apps
parent595412fb5ea2ff0ff2c8a88a22809869c677c44b (diff)
parentbf6071608e45b755daf1c87a835e95512d3c5296 (diff)
downloadnextcloud-server-a87ecd1a4f68f10d280432ae13006bbc0a781f1b.tar.gz
nextcloud-server-a87ecd1a4f68f10d280432ae13006bbc0a781f1b.zip
Merge pull request #38420 from nextcloud/backport/38259/stable27
[stable27] reload filelist when adding or removing shares
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js7
-rw-r--r--apps/files_sharing/src/mixins/ShareRequests.js7
2 files changed, 11 insertions, 3 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index e3052ea9fe8..442fdec9322 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -383,6 +383,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) {
@@ -2201,7 +2204,7 @@
*
* @return ajax call object
*/
- reload: function() {
+ reload: function(keepOpen) {
this._selectedFiles = {};
this._selectionSummary.clear();
if (this._currentFileModel) {
@@ -2216,7 +2219,7 @@
properties: this._getWebdavProperties()
}
);
- if (this._detailsView) {
+ if (this._detailsView && !keepOpen) {
// close sidebar
this._updateDetailsView(null);
}
diff --git a/apps/files_sharing/src/mixins/ShareRequests.js b/apps/files_sharing/src/mixins/ShareRequests.js
index 4218eecc485..e1d246b7400 100644
--- a/apps/files_sharing/src/mixins/ShareRequests.js
+++ b/apps/files_sharing/src/mixins/ShareRequests.js
@@ -29,6 +29,7 @@ import 'url-search-params-polyfill'
import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import Share from '../models/Share.js'
+import { emit } from '@nextcloud/event-bus'
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares')
@@ -57,7 +58,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
@@ -81,6 +84,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)
@@ -102,6 +106,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 {