From fc3f1f69426437f216ae4c6c9ac006e31887d3dd Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 19 Oct 2015 18:40:40 +0000 Subject: [PATCH 1/2] Add direct link to parent notice This is partly for usability, and partly to make Linkbacks for replies work (when the plugin is enabled). --- lib/noticelistitem.php | 21 ++++++++++++++++++++- theme/base/css/display.css | 8 ++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index dc171409f4..f38c7eb0ba 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -150,7 +150,13 @@ class NoticeListItem extends Widget $this->elementStart('section', array('class'=>'notice-headers')); $this->showNoticeTitle(); $this->showAuthor(); - if ($this->addressees) { $this->showAddressees(); } + + if (!empty($this->notice->reply_to) || $this->addressees) { + $this->elementStart('div', array('class' => 'parents')); + if (!empty($this->notice->reply_to)) { $this->showParent(); } + if ($this->addressees) { $this->showAddressees(); } + $this->elementEnd('div'); + } $this->elementEnd('section'); } @@ -247,6 +253,19 @@ class NoticeListItem extends Widget } } + function showParent() + { + $this->out->element( + 'a', + array( + 'href' => $this->notice->getParent()->getUrl(), + 'class' => 'u-in-reply-to', + 'rel' => 'in-reply-to' + ), + 'in reply to' + ); + } + function showAddressees() { $pa = $this->getProfileAddressees(); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 20f9aa775f..0d3515ba33 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -648,12 +648,12 @@ address .poweredby { width:100%; } -.notice .p-author { - margin-right: 8px; +.notice .parents { + display: inline; } -.notice .addressees::before { - content: '\25B8'; +.notice .parents::before { + content: '\25B8 '; } .notice .addressees, .notice .addressees li { display: inline; From cd22be33748f16b4516e259b85dc77b14be5f8bf Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Fri, 23 Oct 2015 18:51:33 +0000 Subject: [PATCH 2/2] Only show parent wrapper if there are some --- lib/noticelistitem.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index f38c7eb0ba..2e2d387c8c 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -64,6 +64,7 @@ class NoticeListItem extends Widget protected $options = true; protected $maxchars = 0; // if <= 0 it means use full posts protected $item_tag = 'li'; + protected $pa = null; /** * constructor @@ -151,7 +152,7 @@ class NoticeListItem extends Widget $this->showNoticeTitle(); $this->showAuthor(); - if (!empty($this->notice->reply_to) || $this->addressees) { + if (!empty($this->notice->reply_to) || count($this->getProfileAddressees()) > 0) { $this->elementStart('div', array('class' => 'parents')); if (!empty($this->notice->reply_to)) { $this->showParent(); } if ($this->addressees) { $this->showAddressees(); } @@ -286,19 +287,20 @@ class NoticeListItem extends Widget function getProfileAddressees() { - $pa = array(); + if($this->pa) { return $this->pa; } + $this->pa = array(); $attentions = $this->getReplyProfiles(); foreach ($attentions as $attn) { $class = $attn->isGroup() ? 'group' : 'account'; - $pa[] = array('href' => $attn->profileurl, - 'title' => $attn->getNickname(), - 'class' => "addressee {$class}", - 'text' => $attn->getStreamName()); + $this->pa[] = array('href' => $attn->profileurl, + 'title' => $attn->getNickname(), + 'class' => "addressee {$class}", + 'text' => $attn->getStreamName()); } - return $pa; + return $this->pa; } function getReplyProfiles()