}
}
- 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) {
}
}
- 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;
}
}
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.
* 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.
* @return string
*/
- function transport()
+ public function transport()
{
return 'distrib';
}
* @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) {
// 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)
);