• 3 Nov '15

Ways to reproduce:

Unrelated: Shouldn't new topics also have a red marker indicating unread comments?

• 3 Nov '15

Haven't yet found the source of the problem but it might be the if on this line.

nitelyEsteban Castro Borsani
• 3 Nov '15

That is actually a feature. The bookmark does not save the greater/latest read comment but the last read comment. Back in the day it made sence to me, since I wanted it to work like a real bookmark where you can go back if you want. I'm up for changing that behaviour though.

Unrelated: Shouldn't new topics also have a red marker indicating unread comments?

No. The red marker indicates there are unread comment in a topic you have visited. New topics have highlighted titles/links (not greyed out like visited topics have), that's the only thing that give them away.

Haven't yet found the source of the problem but it might be the if on this line.

That's not it. The renderer page should have something like:

<div class="comments" data-bookmark="21">
...
</div>

Then we should retrieve it here instead of retrieving it from the location bar.

nitelyEsteban Castro Borsani
• 3 Nov '15

This should also be modified to update the bookmark if the comment_number < new_comment_number.

• 4 Nov '15

@nitely said:
That is actually a feature. The bookmark does not save the greater/latest read comment but the last read comment. Back in the day it made sence to me, since I wanted it to work like a real bookmark where you can go back if you want. I'm up for changing that behaviour though.

It confused me for quite a while, because I would often just press back twice to get back to the category list instead of clicking on the forum title or breadcrumb. In my mind, once you open it, it's read.

nitelyEsteban Castro Borsani
• 3
• 5 Nov '15

Makes sense, I think you are right.

May be we can keep both behaviours, the bookmark would be updated when going back by using the paginator and it would not be updated when going back by hitting the back button.

Just changing this filter to update the bookmark when comment_number__lt=comment_number should fix it.

• 5 Dec '15

This feature makes A LOT of requests if users are just scrolling around. I think both the js and form need to be improved.

• 1
• 5 Dec '15

Ok so the change in the backend is pretty straight-forward, as you suggested.

https://github.com/alesdotio/Spirit/commit/002af0c4ec96e1a56a5ab068280ace9331e62222

I think it's still a problem that the js makes a request every time you scroll past an old comment. I suggest that $.fn.bookmark is rewritten to accept the current bookmark.comment_number from the backend and then check against it, if it should make a request. nitelyEsteban Castro Borsani • 1 • 5 Dec '15 This feature makes A LOT of requests if users are just scrolling around. I think both the js and form need to be improved. It makes one request per comment, as it should. What do you suggest? I think it's still a problem that the js makes a request every time you scroll past an old comment. I suggest that$.fn.bookmark is rewritten to accept the current bookmark.comment_number from the backend and then check against it, if it should make a request.

It's not a problem, that's the worst case scenario, user has not read any of the comments so there will be a request per comment. You should not code for “best case scenario”, ie: the user scrolling too fast, short comments, etc, that just adds complexity for little gain.

• 5 Dec '15

IMO it should not send a request if the comment was already read. But the js plugin does not know that at the moment.

• 5 Dec '15

I don't have any metrics and the request is simple (fast) enough, but I suspect there would be some performance implications if your forum had thousands of users making that many requests by just scrolling through.

nitelyEsteban Castro Borsani
• 1
• 5 Dec '15

I removed that part in my previous comment since I changed my mind, haha. Still too little gain.

I thought about adding a timeout to delay the request 1 sec, but it comes with it's own set of issues, ie: if the user closes the window before the request fires, the topic list will show there are unread comments (red icon). The ultimate solution would be making the unread comments a first class feature instead of the hack it's now.

• 5 Dec '15

It's just concerning to see stuff like this in your logs

[05/Dec/2015 17:02:03]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:03]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2
[05/Dec/2015 17:02:04]"POST /forum/comment/bookmark/2/create/ HTTP/1.1" 200 2

A sane timeout between requests would go a long way I think, even if it's just 0.5s. You could delay only requests that are done right after the first. Basically a form of simple throttling. Was the last request less than 1s ago? Then delay for 1s.

nitelyEsteban Castro Borsani
• 5 Dec '15

I don't have any metrics and the request is simple (fast) enough, but I suspect there would be some performance implications if your forum had thousands of users making that many requests by just scrolling through.

Speculations :) . Not really, the request is as fast as it gets. If the server takes way too long to respond, the user has a crappy connection or whatever, then there will only be two request, 1 for the first comment and 1 for the last comment.

Users tends to open many tabs which is far worst, if you have to worry about something, worry about that

nitelyEsteban Castro Borsani
• 1
• 5 Dec '15

It's just concerning to see stuff like this in your logs

If it make you feel any better discourse is even worse and flarum it's on par with Spirit. But seriously, I would consider adding a delay if the unread comments feature would not depend on it.

• 5 Dec '15

Yes, they are just speculations ;)

• Page 1 of 1