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

Amount of really read comments

The original settings of Vanilla are
$Configuration['Vanilla']['Discussions']['MaxPages'] = 100;
$Configuration['Vanilla']['Comments']['PerPage'] = '30';
$Configuration['Vanilla']['Discussions']['PerCategory'] = '5';
$Configuration['Vanilla']['Discussions']['PerPage'] = '30';

But the problem is, when I am entering a discussion or reading some comments inside a discussion, the amout of read comments is allways increased by the number of Comments per page. So after visiting the 2nd page of a discussion, i read 60 comments.
My solution was to set the number of comments per page to 1 and use the infinite scroll plugin, but in this case i lose every kind of pagination.

Is there any way to get the correct number of really read comments?

Comments

  • hgtonighthgtonight ∞ · New Moderator

    What do you need the read comments for?

    What is the use case?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • the use case is to get the correct number of unread comments.
    let's say you have a discussion with about 300+ comments, which you don't read at once. so you start reading, finish reading and come back later. and if you click on the discussion this time i want the user to be moved to the comment he had read the last time and not the first one on the next page.
    at the moment it is like this:
    i read the first site (p.e. 30 comments/site), i switch to the 2nd site and read 5 comments (->35th comment). i finish reading and if i come back later, i am moved to the 61st comment.

    since scrolling over comments allways changes the URL it should be possible to get the correct number of read comments?

    is there a plugin for i haven't found? or can you tell me where in the code the number of read comments is set (i know the table & value in the database).

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    The use case you describe is the standard behaviour for Vanilla. Skipping to the next page isn't.

    Try disabling plugins and setting theme to default and seeing if the issue persists.

  • hgtonighthgtonight ∞ · New Moderator

    @cko12 said:
    the use case is to get the correct number of unread comments.
    let's say you have a discussion with about 300+ comments, which you don't read at once. so you start reading, finish reading and come back later. and if you click on the discussion this time i want the user to be moved to the comment he had read the last time and not the first one on the next page.

    So you want to remove the assumption that a comment that has been rendered has not been read?

    This is a cool feature, but it may not scale. You could use JS to detect if a comment is on the screen and increment your watch count 1 by 1.

    can you tell me where in the code the number of read comments is set (i know the table & value in the database).

    The user watch is set in the CommentModel: https://github.com/vanilla/vanilla/blob/039b814b4ee7f2954ccc4921ee799bcccdb4e5ef/applications/vanilla/models/class.commentmodel.php#L436-L560

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.