Permalink
Browse files

do not show unread-comments icon if comment is by ignored user

  • Loading branch information...
killelea committed Nov 27, 2016
1 parent 8217fff commit 2a13bdda46f344d96ad29e422c668ddd9a5fcba9
Showing with 21 additions and 6 deletions.
  1. +21 −6 html/functions.php
@@ -101,6 +101,25 @@ function text2hashtags($text) { // given some text, pull out first 3 hashtags
return array_values(array_unique($matches[1]));
}
function unread_comments_icon($post, $is_ignoring_me, $last_view) { // print blinky icon showing that there are unread comments in a post
global $current_user;
// If post_modified > last time they viewed this post, then give them a link to earliest unread comment.
if (strtotime($post->post_modified) > strtotime($last_view[$post->post_ID])) {
// if the latest comment in that post is not by an ignored user, then give the the alert icon that there are new comments
if ($current_user->ignorrhash[ $post->latest_commenter_ID ]) return ''; // Don't show icon if comment from user I ignore.
if ($is_ignoring_me[ $post->latest_commenter_ID ]) return ''; // Don't show icon if comment from user who is ignoring me.
$since = strtotime($last_view[$post->post_ID]);
$unread = " <A HREF='/since.php?p=$post->post_ID&since=$since' >";
$unread .= "<IMG SRC='/content/unread_comments.gif' height='16' title='View unread comments'></A> &nbsp; ";
return $unread;
}
}
function post_list($posts) {
// does nothing but format and display a list of posts from whatever source.
@@ -136,12 +155,7 @@ function post_list($posts) {
if (!$last_view[$post->post_ID])
$unread = "<a href='$path'><IMG SRC='/content/unread_post.gif' title='You never read this one'></a> &nbsp;";
else {
// If post_modified > last time they viewed this post, then give them a link to earliest unread comment.
if (strtotime($post->post_modified) > strtotime($last_view[$post->post_ID])) {
$since = strtotime($last_view[$post->post_ID]);
$unread = " <A HREF='/since.php?p=$post->post_ID&since=$since' >";
$unread .= "<IMG SRC='/content/unread_comments.gif' height='16' title='View unread comments'></A> &nbsp; ";
}
$unread = unread_comments_icon($post, $is_ignoring_me, $last_view);
}
}
@@ -460,6 +474,7 @@ function approval_actions($comment_ID) { // Happens when a comment gets approved
post_modified=now(),
comment_count=$comment_count,
latest_comment_ID=$comment_ID,
latest_commenter_ID=$comment_author,
latest_comment_excerpt='$latest_comment_excerpt'
where post_ID=$comment_post_ID");

0 comments on commit 2a13bdd

Please sign in to comment.