From: Mikael Nordfeldth Date: Wed, 5 Nov 2014 18:49:41 +0000 (+0100) Subject: Show permalinks only for local notices X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e90a1f44c43c71a9006446ef44f2a1e5a03b149a;p=quix0rs-gnu-social.git Show permalinks only for local notices the "from [site]" already links to the permalink --- diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index d12a584022..8572c6583e 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -308,7 +308,7 @@ class NoticeListItem extends Widget function showNoticeLink() { $this->out->elementStart('a', array('rel' => 'bookmark', - 'class' => 'u-url timestamp', + 'class' => 'timestamp', 'href' => Conversation::getUrlFromNotice($this->notice))); $this->out->element('time', array('class' => 'dt-published', 'datetime' => common_date_iso8601($this->notice->created), @@ -472,11 +472,19 @@ class NoticeListItem extends Widget */ function showPermalink() { - $this->out->element('a', - array('href' => $this->notice->getLocalUrl(), - 'class' => 'permalink'), - // TRANS: Addition in notice list item for single-notice view. - _('permalink')); + $class = 'permalink u-url'; + if (!$this->notice->isLocal()) { + $class .= ' external'; + } + try { + $this->out->element('a', + array('href' => $this->notice->getUrl(), + 'class' => $class), + // TRANS: Addition in notice list item for single-notice view. + _('permalink')); + } catch (InvalidUrlException $e) { + // no permalink available + } } /** diff --git a/theme/base/css/display.css b/theme/base/css/display.css index d78c2f3d48..bff926bd27 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -991,6 +991,10 @@ content: ":"; content: '['; } +.notice .permalink.external { + display: none; +} + /* old school conversation style */ #conversation .notices .notices {