* @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
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);
$new_top = null;
- if ($notice instanceof ArrayWrapper) {
- $new_top = $notice->_items[0]->id;
+ if ($notice->fetch()) {
+ $new_top = $notice->id;
}
// TRANS: Subject for e-mail.
$out->elementStart('table', array('width' => '550px',
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
- while ($notice->fetch()) {
+ do {
$profile = Profile::getKV('id', $notice->profile_id);
if (empty($profile)) {
$out->element('a', array('href' => $profile->profileurl),
$profile->nickname);
$out->text(' ');
- $out->raw($notice->rendered);
+ $out->raw($notice->getRendered());
$out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
- $noticeurl = $notice->getUrl();
+ $noticeurl = $notice->getLocalUrl();
// above should always return an URL
assert(!empty($noticeurl));
$out->elementStart('a', array('rel' => 'bookmark',
$out->elementEnd('div');
$out->elementEnd('td');
$out->elementEnd('tr');
- }
+ } while ($notice->fetch());
$out->elementEnd('table');