From 1946197a1c3095e35cfc2ccdded8de5ac77674b1 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 6 Jan 2016 00:48:03 +0100 Subject: [PATCH] Merge request #10 by aroque but in a slightly different version --- classes/Notice.php | 21 +++++++++++++++++++-- lib/noticelistitem.php | 6 +++--- lib/threadednoticelist.php | 4 ++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 513888d245..c99da34c73 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1721,9 +1721,9 @@ class Notice extends Managed_DataObject * * @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); @@ -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, * as previously recorded by saveKnownGroups(). diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index a440c4dd62..4c4bde34a1 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -297,7 +297,7 @@ class NoticeListItem extends Widget if($this->pa) { return $this->pa; } $this->pa = array(); - $attentions = $this->getReplyProfiles(); + $attentions = $this->getAttentionProfiles(); foreach ($attentions as $attn) { $class = $attn->isGroup() ? 'group' : 'account'; @@ -310,9 +310,9 @@ class NoticeListItem extends Widget return $this->pa; } - function getReplyProfiles() + function getAttentionProfiles() { - return $this->notice->getReplyProfiles(); + return $this->notice->getAttentionProfiles(); } /** diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index ebf0a46089..4b5d28de3f 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -282,9 +282,9 @@ class ThreadedNoticeListSubItem extends NoticeListItem // } - function getReplyProfiles() + function getAttentionProfiles() { - $all = parent::getReplyProfiles(); + $all = parent::getAttentionProfiles(); $profiles = array(); -- 2.39.5