-
-
Save mkgl/05e30173624e11e9ee34 to your computer and use it in GitHub Desktop.
Async actions ✕ SystemContext ✕ MessagesManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/magnolia-ui-framework/src/main/java/info/magnolia/ui/framework/action/AbstractCommandAction.java b/magnolia-ui-framework/src/main/java/info/magnolia/ui/framework/action/AbstractCommandAction.java | |
index 6c4ee61..0b25b82 100644 | |
--- a/magnolia-ui-framework/src/main/java/info/magnolia/ui/framework/action/AbstractCommandAction.java | |
+++ b/magnolia-ui-framework/src/main/java/info/magnolia/ui/framework/action/AbstractCommandAction.java | |
@@ -33,6 +33,7 @@ | |
*/ | |
package info.magnolia.ui.framework.action; | |
+import info.magnolia.cms.security.User; | |
import info.magnolia.commands.CommandsManager; | |
import info.magnolia.commands.chain.Command; | |
import info.magnolia.context.Context; | |
@@ -96,6 +97,8 @@ public class AbstractCommandAction<D extends CommandActionDefinition> extends Ab | |
private Object schedulerModule; | |
+ private User user; | |
+ | |
private String commandName; | |
private String catalogName; | |
@@ -118,6 +121,7 @@ public class AbstractCommandAction<D extends CommandActionDefinition> extends Ab | |
private void init(final CommandsManager commandsManager, final SimpleTranslator i18n) { | |
this.commandsManager = commandsManager; | |
this.i18n = i18n; | |
+ this.user = MgnlContext.getUser(); | |
// Init Command. | |
commandName = getDefinition().getCommand(); | |
catalogName = getDefinition().getCatalog(); | |
@@ -393,12 +397,12 @@ public class AbstractCommandAction<D extends CommandActionDefinition> extends Ab | |
MessagesManager messagesManager = Components.getComponent(MessagesManager.class); | |
// result 1 stands for success, 0 for error - see info.magnolia.module.scheduler.CommandJob | |
if ((Integer) jobExecutionContext.getResult() == 1) { | |
- messagesManager.sendLocalMessage(new Message(MessageType.INFO, successMessageTitle, successMessage)); | |
+ messagesManager.sendMessage(user.getName(), new Message(MessageType.INFO, successMessageTitle, successMessage)); | |
} else if ((Integer) jobExecutionContext.getResult() == 0) { | |
Message msg = new Message(MessageType.WARNING, errorMessageTitle, errorMessage); | |
msg.setView("ui-admincentral:longRunning"); | |
msg.addProperty("comment", i18n.translate("ui-framework.abstractcommand.asyncaction.errorComment")); | |
- messagesManager.sendLocalMessage(msg); | |
+ messagesManager.sendMessage(user.getName(), msg); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment