aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/fileactions.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r--apps/files/js/fileactions.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 6c031ab06d5..1b94ee15a61 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -142,7 +142,22 @@
var mime = action.mime;
var name = action.name;
var actionSpec = {
- action: action.actionHandler,
+ action: function(fileName, context) {
+ // Actions registered in one FileAction may be executed on a
+ // different one (for example, due to the "merge" function),
+ // so the listeners have to be updated on the FileActions
+ // from the context instead of on the one in which it was
+ // originally registered.
+ if (context && context.fileActions) {
+ context.fileActions._notifyUpdateListeners('beforeTriggerAction', {action: actionSpec, fileName: fileName, context: context});
+ }
+
+ action.actionHandler(fileName, context);
+
+ if (context && context.fileActions) {
+ context.fileActions._notifyUpdateListeners('afterTriggerAction', {action: actionSpec, fileName: fileName, context: context});
+ }
+ },
name: name,
displayName: action.displayName,
mime: mime,