Also do this on submissions too...

This commit is contained in:
justcool393 2023-07-22 13:34:39 -05:00
parent a258a809db
commit 1a407090d9

View file

@ -489,19 +489,20 @@
comments = JSON.parse(localStorage.getItem("old-comment-counts")) || {} comments = JSON.parse(localStorage.getItem("old-comment-counts")) || {}
lastCount = comments['{{p.id}}'] lastCount = comments['{{p.id}}']
if (lastCount)
{ var commentsToCheck = [
{% for c in p.comments %} {% for c in p.comments -%}
{% if not (v and v.id==c.author_id) and not c.voted %} {% if not (v and v.id==c.author_id) and not c.voted %}
if ({{c.created_utc*1000}} > lastCount.t) [{{c.id}}, {{c.created_utc * 1000}}],
try {
document.getElementById("comment-{{c.id}}-only").classList.add('unread')
document.getElementById("comment-{{c.id}}").querySelector(".comment-user-info").innerHTML += "<span>~new~</span>";
}
catch(e) {}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
} ];
commentsToCheck = commentsToCheck.filter(comment => {
return comment[1] > lastCount.t
}).map(comment => comment[0]);
if (lastCount) commentsAddUnreadIndicator(commentsToCheck);
collapsedCommentStorageApply(); collapsedCommentStorageApply();
} }