FEATURE: Post notices become old after 14 days. (#7197)

This commit is contained in:
Dan Ungureanu
2019-03-18 18:20:49 +02:00
committed by GitHub
parent c0a7b06777
commit 976ea160e9
5 changed files with 32 additions and 12 deletions

View File

@@ -432,12 +432,22 @@ createWidget("post-notice", {
tagName: "div.post-notice",
buildClasses(attrs) {
const classes = [];
if (attrs.postNoticeType === "first") {
return ["new-user"];
classes.push("new-user");
} else if (attrs.postNoticeType === "returning") {
return ["returning-user"];
classes.push("returning-user");
}
return [];
if (
new Date() - new Date(attrs.created_at) >
this.siteSettings.old_post_notice_days * 86400000
) {
classes.push("old");
}
return classes;
},
html(attrs) {