Get group attentions back into the "all" feed
This commit is contained in:
parent
0bc7d9c6c6
commit
5842c59ba7
|
@ -979,30 +979,23 @@ class Notice extends Managed_DataObject
|
|||
}
|
||||
}
|
||||
|
||||
if (is_null($groups)) {
|
||||
$groups = $this->getGroups();
|
||||
}
|
||||
|
||||
if (is_null($recipients)) {
|
||||
$recipients = $this->getReplies();
|
||||
}
|
||||
|
||||
$users = $this->getSubscribedUsers();
|
||||
$ptags = $this->getProfileTags();
|
||||
|
||||
// FIXME: kind of ignoring 'transitional'...
|
||||
// we'll probably stop supporting inboxless mode
|
||||
// in 0.9.x
|
||||
|
||||
$ni = array();
|
||||
|
||||
// Give plugins a chance to add folks in at start...
|
||||
if (Event::handle('StartNoticeWhoGets', array($this, &$ni))) {
|
||||
|
||||
$users = $this->getSubscribedUsers();
|
||||
foreach ($users as $id) {
|
||||
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
|
||||
}
|
||||
|
||||
if (is_null($groups)) {
|
||||
$groups = $this->getGroups();
|
||||
}
|
||||
foreach ($groups as $group) {
|
||||
$users = $group->getUserMembers();
|
||||
foreach ($users as $id) {
|
||||
|
@ -1012,12 +1005,10 @@ class Notice extends Managed_DataObject
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($ptags as $ptag) {
|
||||
$users = $ptag->getUserSubscribers();
|
||||
foreach ($users as $id) {
|
||||
if (!array_key_exists($id, $ni)) {
|
||||
$ni[$id] = NOTICE_INBOX_SOURCE_PROFILE_TAG;
|
||||
}
|
||||
$ptAtts = $this->getAttentionsFromProfileTags();
|
||||
foreach ($ptAtts as $key=>$val) {
|
||||
if (!array_key_exists($key, $ni)) {
|
||||
$ni[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1104,6 +1095,19 @@ class Notice extends Managed_DataObject
|
|||
return $ptags;
|
||||
}
|
||||
|
||||
public function getAttentionsFromProfileTags()
|
||||
{
|
||||
$ni = array();
|
||||
$ptags = $this->getProfileTags();
|
||||
foreach ($ptags as $ptag) {
|
||||
$users = $ptag->getUserSubscribers();
|
||||
foreach ($users as $id) {
|
||||
$ni[$id] = NOTICE_INBOX_SOURCE_PROFILE_TAG;
|
||||
}
|
||||
}
|
||||
return $ni;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record this notice to the given group inboxes for delivery.
|
||||
* Overrides the regular parsing of !group markup.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Base class for queue handlers.
|
||||
|
@ -43,7 +43,7 @@ class DistribQueueHandler
|
|||
* @return string
|
||||
*/
|
||||
|
||||
function transport()
|
||||
public function transport()
|
||||
{
|
||||
return 'distrib';
|
||||
}
|
||||
|
@ -61,8 +61,22 @@ class DistribQueueHandler
|
|||
* @param Notice $notice
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
function handle($notice)
|
||||
public function handle(Notice $notice)
|
||||
{
|
||||
// We have to manually add attentions to non-profile subs and non-mentions
|
||||
$ptAtts = $notice->getAttentionsFromProfileTags();
|
||||
foreach (array_keys($ptAtts) as $profile_id) {
|
||||
$profile = Profile::getKV('id', $profile_id);
|
||||
if ($profile instanceof Profile) {
|
||||
try {
|
||||
common_debug('Adding Attention for '.$notice->getID().' profile '.$profile->getID());
|
||||
Attention::saveNew($notice, $profile);
|
||||
} catch (Exception $e) {
|
||||
$this->logit($notice, $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$notice->sendReplyNotifications();
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -107,7 +107,8 @@ class RawInboxNoticeStream extends NoticeStream
|
|||
// Subscription:: is a table of subscriptions (every user is subscribed to themselves)
|
||||
$notice->whereAdd(
|
||||
sprintf('notice.id IN (SELECT notice_id FROM reply WHERE profile_id=%1$d) ' .
|
||||
'OR notice.profile_id IN (SELECT subscribed FROM subscription WHERE subscriber=%d) ' .
|
||||
'OR notice.profile_id IN (SELECT subscribed FROM subscription WHERE subscriber=%1$d) ' .
|
||||
'OR notice.id IN (SELECT notice_id FROM group_inbox WHERE group_id IN (SELECT group_id FROM group_member WHERE profile_id=%1$d))' .
|
||||
'OR notice.id IN (SELECT notice_id FROM attention WHERE profile_id=%1$d)',
|
||||
$this->target->id)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user