Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Right now, when you view a node all of its new comments are suddenly treated as no longer new. This makes it essentially impossible to keep track of which comments on a node you've already seen. The status of a comment, i.e., whether you've seen it or not, should be independent of the status of the node.
Comment | File | Size | Author |
---|---|---|---|
#25 | comments_marked_read.patch | 4.92 KB | drunken monkey |
#21 | comments_marked_read-test_only.patch | 1.97 KB | drunken monkey |
#21 | comments_marked_read.patch | 4.95 KB | drunken monkey |
#20 | comments_marked_read.patch | 2.98 KB | drunken monkey |
#10 | diff_22 | 678 bytes | jik |
Comments
Comment #1
jik CreditAttribution: jik commentedThe attached patch for your evaluation implements this functionality.
The one aspect of the patch that I'm concerned about is that I chose to implement the "read comments" table using ranges rather than recording a single comment in each row, to keep the size of the table small. My concern is that since I'm using ranges, hashes can't be used directly to search the table, so performance will be bad when it gets large.
Comment #2
jik CreditAttribution: jik commentedHere's a better patch for comment.module. The rest of my last patch remains unchanged.
Comment #3
jik CreditAttribution: jik commentedComment #4
jik CreditAttribution: jik commentedHere's a new patch against 4.4.0-rc, which also incorporates my patches for forums list should show new comments and add new "new expanded" comment display modes, since they are all interrelated and it's too hard to separate them now that I've ported all my patches to 4.4.0-rc.
Comment #5
jik CreditAttribution: jik commentedFound a bug. Here's an additional patch on top of the last one.
Comment #6
jik CreditAttribution: jik commentedAnother bug. When I added code for purging old entries from comments_history, I forgot to take that into account in comment_num_new and comment_is_new. Patch attached.
Comment #7
jik CreditAttribution: jik commentedAnother patch, to make it possible to view a comment without marking it read. We use this to display unpublished comments for moderators so that they can approve comments without changing the system's indication of whether they've read them (so they can easily read them in context later).
Comment #8
jik CreditAttribution: jik commentedAnother patch. This is just a bit of paranoia in the code that removes old entries from the comment history.
Comment #9
jik CreditAttribution: jik commentedYet another patch. Shouldn't try to mark a comment read if the comment ID is 0 (i.e., we're previewing a comment that doesn't exist yet!)
Comment #10
jik CreditAttribution: jik commentedYet another patch to fix a precedence error in an SQL statement.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedThe policy here is that the latest patch in the issue should be complete. A reviewer will not look at all the patches posted and figure out which ones add up to the functionality desired.
Furthermore, when one posts more than a few patches for the same issue, he may give the reviewer the impression that he is not properly testing his code before upload. reputation is key in getting the attention/trust of the review team.
Comment #12
ixis.dylan CreditAttribution: ixis.dylan commentedThis is still causing problems for my users, as only comments on the first page are flagged as new. Has anybody tried to fix this?
Comment #13
catchhttp://drupal.org/node/158676
was duplicate
Comment #14
Crimson CreditAttribution: Crimson commentedAn issue 3 years in the making and it's not fixed yet? :P I think this is important enough to warrant some looking at.
Comment #15
catchWell the main issue seems to be that comment display is pretty much handled by the node module - comments don't have any real presence in their own right when displayed (and therefore to be marked as read or not). There's a few issues around where the solution proposed has been a rewrite of the comment module to fix this underlying issue, which is quite a big one in terms of the architecture of that particular module. My site (volunteer/donation run) is looking into fundraising for this for D7, probably the best place to discuss that would be: http://groups.drupal.org/drubb - although not much point until Drupal 6 is released.
Comment #16
Crimson CreditAttribution: Crimson commentedThanks for the link. I'll join the group to see the progression of forum features, which this bug report is for, at its core.
Comment #17
catchhttp://drupal.org/node/279497 was duplicate.
Comment #18
R.Muilwijk CreditAttribution: R.Muilwijk commentedI would not mind rerolling the patch against current head. However, I would like to know or the proposed patch is the solution we want.
Comment #19
drunken monkeyHas this really been around for 6.5 years? It works here on d.o, so this doesn't seem likely …
However, ran into this today myself, so something really seems to be wrong. The attached patch would be an easy fix.
Additionally fixes some suboptimal checks on
$node->comment
incomment_node_view()
– these are (or should be) only of cosmetic nature, but are still a bit WTF for core code. The only relevant bit are the few lines innode_show()
.Comment #20
drunken monkeyComment #21
drunken monkeyHere is also a test case, for this and #955454: Logic for displaying "X new comment(s)" link seems inverted.
Comment #23
drunken monkey#21: comments_marked_read.patch queued for re-testing.
Sorry, can't reproduce this test fail locally. :-/ And since the line where it happens isn't particularly helpful I'd rather be sure there is a bug …
Can someone else reproduce the test fail? ("Comment interface" is the one I modified, so would probably also be the culprit here.) And, in that case, tell me in which test method / line the fail occurs?
Comment #25
drunken monkeyThen maybe like this?
Comment #26
peterpoe CreditAttribution: peterpoe commentedThere's an attempt to solve the issue also here #983632: New comment marker does not work. Maybe the two patches can be merged?
drunken monkey, what is the reasoning behind these changes?
Comment #27
drunken monkeyThe first is just better style (there is a
COMMENT_NODE_HIDDEN
constant for a reason) — and also, the sameif
clause was completely unnecessarily two lines beneath that, so I just "merged" them.In the second, the
$node->comment
part of the boolean expression is completely unnecessary, as this was already tested above (in an enclosingif
).Both have nothing to do with this issue, of course, but some time this should be corrected anyways.
#25: comments_marked_read.patch queued for re-testing.
Comment #29
peterpoe CreditAttribution: peterpoe commentedTest fails since there are other bugs involved, see #983632: New comment marker does not work.
Comment #30
drunken monkeyDear god, what in the whole "new comments" system does even work … ?
Maybe we should merge these two issues, so both can be fixed and tested at once?
Comment #31
catchI don't think we should merge these. As far as I can see there are (at least) two bugs:
First a regression from D6, where all comments get marked read before you even get a chance to look a them.
Second, this original bug, where viewing comments is based on when you last viewed the node, not taking into account paging of comments - to handle that effectively would require a major refactoring of comment module and it's Drupal 8 material at this point.
Comment #32
InternetDevels CreditAttribution: InternetDevels commentedWe had similar problem. When users view any nodes all comments marked as read.
This occurs because database 'history' table updated before comments rendering (function node_show that called in 'node_page_view' page callback for menu item 'node/%node').
We have fixed this in next way:
Comment #33
catchThat's a different bug, the patch at #983632: New comment marker does not work should fix that.
The issue here is that if you have ten pages of comments, visiting any of those pages marks the other nine pages as read too.
Comment #34
dixon_This still applies to 8.x
Comment #35
bleen CreditAttribution: bleen commentedGoogle reader handles this by using javascript and AJAX to mark an item as read only when it is in the viewport. This is visually indicated to the user by highlighting the item wrapper with a dark border while it's being "read" (thus truggering the state change). IMO this is the most accurate reflection of what a user actually expects. I'm not sure what the corresponding non-ajax behavior would be here, but I think this is worth exploring.
Comment #36
star-szrClosed #1666090: "new" indicator isn't showing correctly for comments with pager as a duplicate of this issue.
Comment #37
mototribe CreditAttribution: mototribe commentedWe came up with this workaround - we setup a page at node/[nid]/new to check for new comments and redirect to the correct page at node/[nid]?page=[page]#new
Comment #38
mikhailian CreditAttribution: mikhailian commented25: comments_marked_read.patch queued for re-testing.
Comment #40
larowlanThis isn't something we're going to fix in core.
It can be handled in contrib with a custom formatter and JavaScript if it is important enough to a particular custom project.