From 719b480eaaa3459497c008839606a96cc8f368e1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 8 Nov 2010 13:08:59 -0500 Subject: [PATCH] use subclassing to change notice list output for single notice --- actions/shownotice.php | 26 ++++++++++++++++++++++++++ lib/noticelist.php | 7 ++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/actions/shownotice.php b/actions/shownotice.php index 7cc6c54243..b7e61a1375 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -331,6 +331,32 @@ class SingleNoticeItem extends DoFollowListItem $this->showEnd(); } + /** + * show the avatar of the notice's author + * + * We use the larger size for single notice page. + * + * @return void + */ + + function showAvatar() + { + $avatar_size = AVATAR_PROFILE_SIZE; + + $avatar = $this->profile->getAvatar($avatar_size); + + $this->out->element('img', array('src' => ($avatar) ? + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size), + 'class' => 'avatar photo', + 'width' => $avatar_size, + 'height' => $avatar_size, + 'alt' => + ($this->profile->fullname) ? + $this->profile->fullname : + $this->profile->nickname)); + } + function showNoticeAttachments() { $al = new AttachmentList($this->notice, $this->out); $al->show(); diff --git a/lib/noticelist.php b/lib/noticelist.php index bdf2530b34..6f82c9269b 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -327,11 +327,8 @@ class NoticeListItem extends Widget function showAvatar() { - if ('shownotice' === $this->out->trimmed('action')) { - $avatar_size = AVATAR_PROFILE_SIZE; - } else { - $avatar_size = AVATAR_STREAM_SIZE; - } + $avatar_size = AVATAR_STREAM_SIZE; + $avatar = $this->profile->getAvatar($avatar_size); $this->out->element('img', array('src' => ($avatar) ?