From 3d8b776dc75eef86be72f648b23dda7c7a25f60c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 20 Jun 2011 10:26:24 -0400 Subject: [PATCH] don't double-show summary and content --- plugins/Blog/Blog_entry.php | 6 ++++++ plugins/Blog/blogentrylistitem.php | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) 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); + } } } -- 2.39.5