Added last edit time to basic post information

This commit is contained in:
Marcin Kurczewski 2014-09-25 22:10:28 +02:00
parent 77365e500a
commit a7c07d32df
3 changed files with 8 additions and 2 deletions

2
TODO
View file

@ -3,8 +3,6 @@ first major release.
everything related to posts: everything related to posts:
- single post view - single post view
- basic information
- time of last edit
- fav - fav
- score (see notes about scoring) - score (see notes about scoring)
- editing - editing

View file

@ -69,6 +69,13 @@
</li> </li>
<% } %> <% } %>
<% if (post.lastEditTime !== post.uploadTime) { %>
<li>
Edited:
<%= formatRelativeTime(post.lastEditTime) %>
</li>
<% } %>
<% if (post.featureCount > 0) { %> <% if (post.featureCount > 0) { %>
<li> <li>
Featured: <%= post.featureCount %> <%= post.featureCount < 2 ? 'time' : 'times' %> Featured: <%= post.featureCount %> <%= post.featureCount < 2 ? 'time' : 'times' %>

View file

@ -115,6 +115,7 @@ class PostService
$transactionFunc = function() use ($post, $formData) $transactionFunc = function() use ($post, $formData)
{ {
$this->validator->validate($formData); $this->validator->validate($formData);
$post->setLastEditTime($this->timeService->getCurrentTime());
if ($formData->content !== null) if ($formData->content !== null)
$this->updatePostContentFromString($post, $formData->content); $this->updatePostContentFromString($post, $formData->content);