Commit cee346ba authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review

Fix the notification about having access to a collection.

Bug 1380201

Change-Id: Ie9aa85fbfe244285322f82a0b06b8287424f50d1
Signed-off-by: default avatarSon Nguyen <sonn@catalyst.net.nz>
parent 28b194d8
...@@ -70,8 +70,11 @@ $string['newviewmessage'] = '%s has created a new page "%s"'; ...@@ -70,8 +70,11 @@ $string['newviewmessage'] = '%s has created a new page "%s"';
$string['newcontactusfrom'] = 'New contact us from'; $string['newcontactusfrom'] = 'New contact us from';
$string['newcontactus'] = 'New contact us'; $string['newcontactus'] = 'New contact us';
$string['newcollectionaccessmessage'] = 'You have been added to the access list for the collection "%s" by %s';
$string['newviewaccessmessage'] = 'You have been added to the access list for the page "%s" by %s'; $string['newviewaccessmessage'] = 'You have been added to the access list for the page "%s" by %s';
$string['newcollectionaccessmessagenoowner'] = 'You have been added to the access list for the collection "%s"';
$string['newviewaccessmessagenoowner'] = 'You have been added to the access list for the page "%s"'; $string['newviewaccessmessagenoowner'] = 'You have been added to the access list for the page "%s"';
$string['newcollectionaccesssubject'] = 'New access to collection "%s"';
$string['newviewaccesssubject1'] = 'New access to page "%s"'; $string['newviewaccesssubject1'] = 'New access to page "%s"';
$string['viewmodified'] = 'has changed their page'; $string['viewmodified'] = 'has changed their page';
......
...@@ -1277,6 +1277,7 @@ class ActivityTypeViewAccess extends ActivityType { ...@@ -1277,6 +1277,7 @@ class ActivityTypeViewAccess extends ActivityType {
private $title, $ownername; private $title, $ownername;
private $incollection = false;
/** /**
* @param array $data Parameters: * @param array $data Parameters:
* - view (int) * - view (int)
...@@ -1295,21 +1296,30 @@ class ActivityTypeViewAccess extends ActivityType { ...@@ -1295,21 +1296,30 @@ class ActivityTypeViewAccess extends ActivityType {
activity_get_viewaccess_users($this->view), activity_get_viewaccess_users($this->view),
$this->oldusers $this->oldusers
); );
$this->title = $viewinfo->get('title'); if ($viewinfo->get_collection()) {
$this->incollection = true;
$this->title = $viewinfo->get_collection()->get('name');
$this->add_urltext(array('key' => 'Collection', 'section' => 'collection'));
}
else {
$this->title = $viewinfo->get('title');
$this->add_urltext(array('key' => 'View', 'section' => 'view'));
}
$this->ownername = $viewinfo->formatted_owner(); $this->ownername = $viewinfo->formatted_owner();
$this->add_urltext(array('key' => 'View', 'section' => 'view'));
} }
public function get_subject($user) { public function get_subject($user) {
return get_string('newviewaccesssubject1', 'activity', $this->title); return $this->incollection ? get_string('newcollectionaccesssubject', 'activity', $this->title) : get_string('newviewaccesssubject1', 'activity', $this->title);
} }
public function get_message($user) { public function get_message($user) {
$newaccessmessagestr = $this->incollection ? 'newcollectionaccessmessage' : 'newviewaccessmessage';
$newaccessmessagenoownerstr = $this->incollection ? 'newcollectionaccessmessagenoowner' : 'newviewaccessmessagenoowner';
if ($this->ownername) { if ($this->ownername) {
return get_string_from_language($user->lang, 'newviewaccessmessage', 'activity', return get_string_from_language($user->lang, $newaccessmessagestr, 'activity',
$this->title, $this->ownername); $this->title, $this->ownername);
} }
return get_string_from_language($user->lang, 'newviewaccessmessagenoowner', 'activity', $this->title); return get_string_from_language($user->lang, $newaccessmessagenoownerstr, 'activity', $this->title);
} }
public function get_required_parameters() { public function get_required_parameters() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment