Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

starter topic gets the wrong class

jackmaessenjackmaessen ✭✭✭
edited December 2014 in Vanilla 2.0 - 2.8

It is all about this function (applications\vanilla\views\discussions\helper_functions.php)

      if (!function_exists('NewComments')):
      function NewComments($Discussion) {
       if (!Gdn::Session()->IsValid())
          return '';

       if ($Discussion->CountUnreadComments === TRUE) {
          $Title = htmlspecialchars(T("You haven't read this yet."));

          return ' <strong class="HasNew JustNew NewCommentCount" title="'.$Title.'">'.T('new discussion', 'new').'</strong>';
       } elseif ($Discussion->CountUnreadComments > 0) {
          $Title = htmlspecialchars(Plural($Discussion->CountUnreadComments, "%s new comment since you last read this.", "%s new comments since you last read this."));

          return ' <strong class="HasNew NewCommentCount" title="'.$Title.'">'.Plural($Discussion->CountUnreadComments, '%s new', '%s new plural', BigPlural($Discussion->CountUnreadComments, '%s new', '%s new plural')).'</strong>';
       }
       return '';
    }
    endif;

First of all: i translated T('new discussion', 'new') to T('new discussion', 'New Topic')...ofcourse in the locale.php

What happens: person A starts a new topic. Person B sees this topic as "New Topic". He gives a comment on that topic.
Person A sees this comment as "New Topic". That's wrong. He is the starter of the topic and for him it is not anymore a "New Topic".
Person A reads the comment. Person B writes another comment in the same topic. At this time, Person A sees "1 new" at the topic.

But that "1 new" should appear immediately after posting the first comment in that topic.

So there should be something like this in the code above:

if ($Discussion->CountUnreadComments === TRUE || $Discussion->Starter != $you) {

How can i realise that?

Note: ofcourse this was not a real issue if i did not translate new to New Topic, but i want to make difference between a new topic and an existing topic with a new comment; so i gave the class JustNew a green background-color and HasNew a blue bg-color

Comments

Sign In or Register to comment.