Consistent behaviour for ScopingNoticeStream $scoped

We don't guess the current profile anymore if the value of the profile === -1

Also sets $this->scoped for all ScopingNoticeStream inheritors, which just
like in an Action can be null if we're not scoped in any way (logged in).
This commit is contained in:
Mikael Nordfeldth
2016-03-01 14:51:47 +01:00
parent 7862b853bf
commit 63c087a255
38 changed files with 151 additions and 239 deletions

View File

@@ -26,9 +26,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Handler for queue items of type 'usersum', sends an email summaries
@@ -95,15 +93,15 @@ class UserEmailSummaryHandler extends QueueHandler
return true;
}
$profile = $user->getProfile();
if (empty($profile)) {
try {
$profile = $user->getProfile();
} catch (UserNoProfileException $e) {
common_log(LOG_WARNING, sprintf('Not sending email summary for user %s; no profile.', $user_id));
return true;
}
// An InboxNoticeStream for a certain user, scoped to its own view
$stream = new InboxNoticeStream($profile);
$stream = new InboxNoticeStream($profile, $profile);
$notice = $stream->getNotices(0, self::MAX_NOTICES, $since_id);