From ee4d78cae3a6ab423ce77e981b033d693beb7fd4 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 27 Jun 2019 12:05:31 -0400 Subject: [PATCH] feat: closes #7718 --- public/language/en-GB/topic.json | 4 +++- public/less/generics.less | 8 ++++++++ public/src/client/topic/posts.js | 25 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/public/language/en-GB/topic.json b/public/language/en-GB/topic.json index be64432767..40d18227bb 100644 --- a/public/language/en-GB/topic.json +++ b/public/language/en-GB/topic.json @@ -152,5 +152,7 @@ "diffs.description": "This post has %1 revisions. Click one of the revisions below to see the post content at that point in time.", "diffs.no-revisions-description": "This post has %1 revisions.", "diffs.current-revision": "current revision", - "diffs.original-revision": "original revision" + "diffs.original-revision": "original revision", + + "timeago_later": "%1 later" } diff --git a/public/less/generics.less b/public/less/generics.less index 257d054c6c..9cd479cf98 100644 --- a/public/less/generics.less +++ b/public/less/generics.less @@ -148,3 +148,11 @@ max-width: 100%; } } + +.topic .necro-post { + color: rgba(127,127,127,.5); + font-size: 1.5em; + margin-bottom: 20px; + text-align: center; + text-transform: uppercase; +} \ No newline at end of file diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index f794354abc..a7eaabf657 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -255,8 +255,33 @@ define('forum/topic/posts', [ posts.find('[component="post/content"] img:not(.not-responsive)').addClass('img-responsive'); Posts.addBlockquoteEllipses(posts); hidePostToolsForDeletedPosts(posts); + + addNecroPostMessage(); }; + function addNecroPostMessage() { + var necroThreshold = 7 * 24 * 60 * 60 * 1000; + $('[component="post"]').each(function () { + var post = $(this); + var prev = post.prev('[component="post"]'); + if (post.is(':has(.necro-post)') || !prev.length) { + return; + } + + var diff = post.attr('data-timestamp') - prev.attr('data-timestamp'); + if (diff >= necroThreshold) { + var ago = $.timeago.settings.strings.suffixAgo; + $.timeago.settings.strings.suffixAgo = ''; + $('