Permalink
Browse files

Remove notifications from GLOBAL_TYPES, add an option to disable Acti…

…vity panel.
  • Loading branch information...
1 parent e9acca3 commit 9e0ce4d8e8e578d8e2cf0474d2c0d2daada45a80 @cdujeu cdujeu committed Sep 5, 2016
@@ -282,7 +282,7 @@ public function rolesActions(ServerRequestInterface $requestInterface, ResponseI
// Make sure it's utf8
$data["ALL"] = array_merge((isSet($data["ALL"]) ? $data["ALL"]: []), [
"PLUGINS_SCOPES" => [
- "GLOBAL_TYPES" => ["conf", "auth", "authfront", "log", "mq", "notifications", "gui", "sec"],
+ "GLOBAL_TYPES" => ["conf", "auth", "authfront", "log", "mq", "gui", "sec"],
"GLOBAL_PLUGINS" => ["action.avatar", "action.disclaimer", "action.scheduler", "action.skeleton", "action.updater"]
],
"REPOSITORIES" => $repos,
@@ -81,23 +81,29 @@ public function init(ContextInterface $ctx, $options = [])
*/
protected function parseSpecificContributions(ContextInterface $ctx, \DOMNode &$contribNode)
{
- parent::parseSpecificContributions($ctx, $contribNode);
-
- // DISABLE STUFF
- if (empty($this->pluginConf["USER_EVENTS"])) {
- if($contribNode->nodeName == "actions"){
- $actionXpath=new DOMXPath($contribNode->ownerDocument);
- $publicUrlNodeList = $actionXpath->query('action[@name="get_my_feed"]', $contribNode);
- $publicUrlNode = $publicUrlNodeList->item(0);
- $contribNode->removeChild($publicUrlNode);
- }else if($contribNode->nodeName == "client_configs"){
- $actionXpath=new DOMXPath($contribNode->ownerDocument);
- $children = $actionXpath->query('component_config', $contribNode);
- foreach($children as $child){
- $contribNode->removeChild($child);
- }
+ parent::parseSpecificContributions($ctx, $contribNode);
+ $disableWsActivity = $this->getContextualOption($ctx, "SHOW_WORKSPACES_ACTIVITY") === false;
+ $disableUserEvents = $this->getContextualOption($ctx, "USER_EVENTS") === false;
+ if(!$disableUserEvents && !$disableWsActivity){
+ return;
+ }
+ // DISABLE STUFF AS NEEDED
+ if($contribNode->nodeName == "actions" && $disableUserEvents){
+ $actionXpath=new DOMXPath($contribNode->ownerDocument);
+ $publicUrlNodeList = $actionXpath->query('action[@name="get_my_feed"]', $contribNode);
+ $publicUrlNode = $publicUrlNodeList->item(0);
+ $contribNode->removeChild($publicUrlNode);
+ }else if($contribNode->nodeName == "client_configs"){
+ $actionXpath=new DOMXPath($contribNode->ownerDocument);
+ $children = $actionXpath->query('component_config', $contribNode);
+ /** @var \DOMElement $child */
+ foreach($children as $child){
+ if($child->getAttribute("className") !== "InfoPanel" && !$disableUserEvents){
+ continue;
}
+ $contribNode->removeChild($child);
}
+ }
}
/**
@@ -17,7 +17,8 @@
</client_settings>
<server_settings>
<param name="activate_notifications" scope="user" description="CONF_MESSAGE[Activate desktop notifications]" label="CONF_MESSAGE[Desktop Notifications]" type="button" choices="run_client_action:activateDesktopNotifications" expose="true" editable="true"/>
- <global_param description="CONF_MESSAGE[Display a new entry with all events happening on a user workspaces, and alerts. An SQL database must be setup for the FEED_DRIVER configuration.]" label="CONF_MESSAGE[User events and alerts]" name="USER_EVENTS" type="boolean" default="false"/>
+ <global_param name="USER_EVENTS" description="CONF_MESSAGE[Display a new entry with all events happening on a user workspaces, and alerts. An SQL database must be setup for the FEED_DRIVER configuration.]" label="CONF_MESSAGE[User events and alerts]" type="boolean" default="false"/>
+ <global_param name="SHOW_WORKSPACES_ACTIVITY" label="CONF_MESSAGE[Display Workspaces Activity]" description="CONF_MESSAGE[Display workspaces activity to the users in the right-hand information panel]" type="boolean" default="true"/>
<global_param type="plugin_instance:feed" name="UNIQUE_FEED_INSTANCE" group="CONF_MESSAGE[Instance Params]" label="CONF_MESSAGE[Feed Instance]" description="CONF_MESSAGE[Choose the plugin]" mandatory="true" default="feed.sql"/>
</server_settings>
<registry_contributions>

0 comments on commit 9e0ce4d

Please sign in to comment.