Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Compute locationType when setting node, so that it can be serialized/…
Browse files Browse the repository at this point in the history
…unserialized
  • Loading branch information
cdujeu committed Jan 4, 2016
1 parent a37018a commit 94f1fda
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/src/plugins/core.notifications/class.AJXP_Notification.php
Expand Up @@ -72,6 +72,11 @@ class AJXP_Notification

public static $usersCaches = array();

/**
* @var string A hint about the current context (workspace, shared minisite, etc..)
*/
private $locationType;

public static function autoload()
{
}
Expand Down Expand Up @@ -208,6 +213,14 @@ public function getDescriptionLong($skipLink = false)

public function getDescriptionLocation(){
$mess = ConfService::getMessages();
if(!isSet($this->locationType)){
$this->computeLocationType();
}
return $this->replaceVars($mess["notification.tpl.location.".$this->locationType], $mess);
}

private function computeLocationType(){

$type = "workspace.normal";
$repo = $this->getNode()->getRepository();
$crtUserId = "shared";
Expand All @@ -222,7 +235,8 @@ public function getDescriptionLocation(){
}else if($repo->hasOwner() && $repo->getOwner() != $crtUserId){
$type = "workspace.shared";
}
return $this->replaceVars($mess["notification.tpl.location.".$type], $mess);

$this->locationType = $type;
}

public function setAction($action)
Expand Down Expand Up @@ -286,6 +300,7 @@ public function getDate()
public function setNode($node)
{
$this->node = $node;
$this->computeLocationType();
}

/**
Expand Down

0 comments on commit 94f1fda

Please sign in to comment.