]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/EmailSummary/lib/useremailsummaryhandler.php
Event upgraded to microformats2
[quix0rs-gnu-social.git] / plugins / EmailSummary / lib / useremailsummaryhandler.php
index 46275c39c49b656760fb71eb1b828ab0f5fdf764..fe814a3fb5ba0610b5547a980f4ae63381c1b263 100644 (file)
@@ -102,7 +102,8 @@ class UserEmailSummaryHandler extends QueueHandler
             return true;
         }
 
-        $stream = new InboxNoticeStream($user, $user->getProfile());
+        // An InboxNoticeStream for a certain user, scoped to its own view
+        $stream = new InboxNoticeStream($profile, $profile);
 
         $notice = $stream->getNotices(0, self::MAX_NOTICES, $since_id);
 
@@ -151,7 +152,7 @@ class UserEmailSummaryHandler extends QueueHandler
                 continue;
             }
 
-            $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
+            $avatarUrl = $profile->avatarUrl(AVATAR_STREAM_SIZE);
 
             $out->elementStart('tr');
             $out->elementStart('td', array('width' => AVATAR_STREAM_SIZE,
@@ -159,9 +160,7 @@ class UserEmailSummaryHandler extends QueueHandler
                                            'align' => 'left',
                                            'valign' => 'top',
                                            'style' => 'border-bottom: 1px dotted #C5CEE3; padding: 10px 6px 10px 6px;'));
-            $out->element('img', array('src' => ($avatar) ?
-                                       $avatar->displayUrl() :
-                                       Avatar::defaultImage(AVATAR_STREAM_SIZE),
+            $out->element('img', array('src' => $avatarUrl,
                                        'width' => AVATAR_STREAM_SIZE,
                                        'height' => AVATAR_STREAM_SIZE,
                                        'alt' => $profile->getBestName()));
@@ -174,7 +173,7 @@ class UserEmailSummaryHandler extends QueueHandler
             $out->text(' ');
             $out->raw($notice->rendered);
             $out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
-            $noticeurl = $notice->bestUrl();
+            $noticeurl = $notice->getUrl();
             // above should always return an URL
             assert(!empty($noticeurl));
             $out->elementStart('a', array('rel' => 'bookmark',
@@ -184,17 +183,9 @@ class UserEmailSummaryHandler extends QueueHandler
                                         'title' => $dt),
                           common_date_string($notice->created));
             $out->elementEnd('a');
-            if ($notice->hasConversation()) {
-                $conv = Conversation::getKV('id', $notice->conversation);
-                $convurl = $conv->uri;
-                if (!empty($convurl)) {
-                    $out->text(' ');
-                    $out->element('a',
-                                  array('href' => $convurl.'#notice-'.$notice->id),
-                                  // TRANS: Link text for link to conversation view.
-                                  _m('in context'));
-                }
-            }
+            $out->element('a', array('href' => $notice->getConversationUrl()),
+                          // TRANS: Link text for link to conversation view.
+                          _m('in context'));
             $out->elementEnd('div');
             $out->elementEnd('td');
             $out->elementEnd('tr');