Merge request #10 by aroque but in a slightly different version

This commit is contained in:
Mikael Nordfeldth 2016-01-06 00:48:03 +01:00
parent 31c8416a8f
commit 1946197a1c
3 changed files with 24 additions and 7 deletions

View File

@ -1721,9 +1721,9 @@ class Notice extends Managed_DataObject
* *
* @return array of Profiles * @return array of Profiles
*/ */
function getReplyProfiles() function getAttentionProfiles()
{ {
$ids = $this->getReplies(); $ids = array_unique(array_merge($this->getReplies(), $this->getGroupProfileIDs()));
$profiles = Profile::multiGet('id', $ids); $profiles = Profile::multiGet('id', $ids);
@ -1759,6 +1759,23 @@ class Notice extends Managed_DataObject
} }
} }
/**
* Pull list of Profile IDs of groups this notice addresses.
*
* @return array of Group _profile_ IDs
*/
function getGroupProfileIDs()
{
$ids = array();
foreach ($this->getGroups() as $group) {
$ids[] = $group->profile_id;
}
return $ids;
}
/** /**
* Pull list of groups this notice needs to be delivered to, * Pull list of groups this notice needs to be delivered to,
* as previously recorded by saveKnownGroups(). * as previously recorded by saveKnownGroups().

View File

@ -297,7 +297,7 @@ class NoticeListItem extends Widget
if($this->pa) { return $this->pa; } if($this->pa) { return $this->pa; }
$this->pa = array(); $this->pa = array();
$attentions = $this->getReplyProfiles(); $attentions = $this->getAttentionProfiles();
foreach ($attentions as $attn) { foreach ($attentions as $attn) {
$class = $attn->isGroup() ? 'group' : 'account'; $class = $attn->isGroup() ? 'group' : 'account';
@ -310,9 +310,9 @@ class NoticeListItem extends Widget
return $this->pa; return $this->pa;
} }
function getReplyProfiles() function getAttentionProfiles()
{ {
return $this->notice->getReplyProfiles(); return $this->notice->getAttentionProfiles();
} }
/** /**

View File

@ -282,9 +282,9 @@ class ThreadedNoticeListSubItem extends NoticeListItem
// //
} }
function getReplyProfiles() function getAttentionProfiles()
{ {
$all = parent::getReplyProfiles(); $all = parent::getAttentionProfiles();
$profiles = array(); $profiles = array();