From a7c07d32dfd83875e4a048137a64490a057fee22 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 25 Sep 2014 22:10:28 +0200 Subject: [PATCH] Added last edit time to basic post information --- TODO | 2 -- public_html/templates/post.tpl | 7 +++++++ src/Services/PostService.php | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 8eef49ec..650e1900 100644 --- a/TODO +++ b/TODO @@ -3,8 +3,6 @@ first major release. everything related to posts: - single post view - - basic information - - time of last edit - fav - score (see notes about scoring) - editing diff --git a/public_html/templates/post.tpl b/public_html/templates/post.tpl index 6b8463a9..6b98697e 100644 --- a/public_html/templates/post.tpl +++ b/public_html/templates/post.tpl @@ -69,6 +69,13 @@ <% } %> + <% if (post.lastEditTime !== post.uploadTime) { %> +
  • + Edited: + <%= formatRelativeTime(post.lastEditTime) %> +
  • + <% } %> + <% if (post.featureCount > 0) { %>
  • Featured: <%= post.featureCount %> <%= post.featureCount < 2 ? 'time' : 'times' %> diff --git a/src/Services/PostService.php b/src/Services/PostService.php index ccaf5df4..57f0ec55 100644 --- a/src/Services/PostService.php +++ b/src/Services/PostService.php @@ -115,6 +115,7 @@ class PostService $transactionFunc = function() use ($post, $formData) { $this->validator->validate($formData); + $post->setLastEditTime($this->timeService->getCurrentTime()); if ($formData->content !== null) $this->updatePostContentFromString($post, $formData->content);