Add timestamp to comment and post notifications (#2565)

This commit adds timestamps to the comment and post notifications.
Instead of using `strftime` and ordinalizing the date I decided to use the
`time_ago_in_words` methods. I think that this looks better and is more
accurate when it comes to notifications recently received. The final say
is up to the main contributors though, if you would like me to change it
back let me know.
This commit is contained in:
Kobe Raypole 2019-04-26 19:43:21 -04:00 committed by Ben Halpern
parent 04d2bb4190
commit 447b1eaa38
2 changed files with 9 additions and 0 deletions

View file

@ -30,6 +30,9 @@
<% if json_data["organization"] %>
under <a href="<%= json_data["organization"]["path"] %>"><%= json_data["organization"]["name"] %></a>:
<% end %>
<div>
<small><%= time_ago_in_words notification.created_at %></small>
</div>
<a href="<%= json_data["article"]["path"] %>">
<div class="notification-new-post">
<div class="notification-new-post-title">

View file

@ -16,6 +16,9 @@
<a href="<%= json_data["comment"]["commentable"]["path"] %>">
<%= sanitize(json_data["comment"]["commentable"]["title"]) %>
</a>
<div>
<small><%= time_ago_in_words notification.created_at %> ago</small>
</div>
<%= render "notifications/shared/comment_box", json_data: json_data, notification: notification, context: "default" %>
<% elsif notification.action == "Moderation" %>
Hey there! <%= image_tag "emoji/apple-hugging-face.png", class: "reaction-image" %> As a trusted member, could you react to this comment
@ -34,6 +37,9 @@
<a href="<%= json_data["comment"]["commentable"]["path"] %>">
<%= sanitize(json_data["comment"]["commentable"]["title"]) %>
</a>
<div>
<small><%= time_ago_in_words notification.created_at %> ago</small>
</div>
<%= render "notifications/shared/comment_box", activity: activity, context: "moderation" %>
Give them their first reply! 🎉
<br>