From: Evan Prodromou Date: Mon, 20 Jun 2011 14:26:24 +0000 (-0400) Subject: don't double-show summary and content X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3d8b776dc75eef86be72f648b23dda7c7a25f60c;p=quix0rs-gnu-social.git don't double-show summary and content --- diff --git a/plugins/Blog/Blog_entry.php b/plugins/Blog/Blog_entry.php index 34e4ea294e..0e4df28b82 100644 --- a/plugins/Blog/Blog_entry.php +++ b/plugins/Blog/Blog_entry.php @@ -127,6 +127,12 @@ class Blog_entry extends Managed_DataObject $be->summary = self::summarize($content); } + // Don't save an identical summary + + if ($be->summary == $be->content) { + $be->summary = null; + } + $url = common_local_url('showblogentry', array('id' => $be->id)); if (!array_key_exists('uri', $options)) { diff --git a/plugins/Blog/blogentrylistitem.php b/plugins/Blog/blogentrylistitem.php index 97a06acfa7..ee937daa77 100644 --- a/plugins/Blog/blogentrylistitem.php +++ b/plugins/Blog/blogentrylistitem.php @@ -71,10 +71,11 @@ class BlogEntryListItem extends NoticeListItemAdapter $out->element('a', array('href' => $notice->bestUrl()), $entry->title); $out->elementEnd('h4'); - $out->element('div', 'blog-entry-summary', $entry->summary); - - // XXX: hide content initially; click More... for full text. - - $out->element('div', 'blog-entry-content', $entry->content); + if (!empty($entry->summary)) { + $out->element('div', 'blog-entry-summary', $entry->summary); + } else { + // XXX: hide content initially; click More... for full text. + $out->element('div', 'blog-entry-content', $entry->content); + } } }