When viewing a list of comments, edited comments jump to the end/start of the list once they have been submitted. This seriously affects the flow of the comments - and can annoy the end users especially if they were just editing an older comment to fix a typo.
This was not a problem in previous version's of Drupal.
The issue is caused by the updating of the timestamp field in the comment_save function in comment.module.
Attached patch simply removes this field from the update statement.
It could be argued that this is not a bug but a feature - if the argument has already taken place and the "feature" gang won then please accept my apologies :)
For future releases (Drupal 6 etc) it might be nice to introduce the a modified date into the comment table.
Comment | File | Size | Author |
---|---|---|---|
#22 | 122098-comment_timestamp_1.patch | 987 bytes | jeffschuler |
#16 | comment.patch | 17.45 KB | catch |
#13 | comment.patch | 17.46 KB | catch |
#9 | comment.patch | 17.45 KB | catch |
#8 | 122098-split-comment-timestamp.patch | 17 KB | Damien Tournoud |
Comments
Comment #1
drummWe don't use
/**
documentation block comments within blocks of code, those need to be//
.We don't put personal credits in either, that is what the CVS log is for.
Changes which affect the site's content will not go in Drupal 5.x, which is the stable branch.
Comment #2
PanchoWe need to do both at the same time: don't update (creation) timestamp but at the same time add a modified timestamp.
I'm very much for this move, but it can't be done in D6 anymore.
Comment #3
catchWe now order by cid instead of timestamp for flat comments, however this still has the effect that edited comments show up as 'new' - drupal.org issue queue is one example. Hoping this would be a code slush patch.
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedFirst stab at this. Given in offering to the test bot god.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis one should already be better.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis one should pass. Careful review of the update code is required.
Comment #9
catchThis will remove a tonne of wtfs when it's in.
The update had to be updated for $ret and update_sql() removal and I also removed a whitespace-only hunk from field.attach.inc
Comment #10
catchTagging.
Comment #11
catchSun gave me permission to add the super-critical this is a complete mess tag in irc.
Comment #12
sunShouldn't we call the column header "Updated" then? (to also make it more consistent with the Content overview table)
Typo in "$coment" here.
I'm on crack. Are you, too?
Comment #13
catchFixed.
Comment #14
sunAwesome, this looks ready to fly now.
Comment #15
Dries CreditAttribution: Dries commentedWe no longer need this return statement.
In the node module, we use 'changed' instead of 'updated'. I'm happy with either, but it feels like we want to be consistent to avoid a minor WTF.
Comment #16
catchHm. Node module uses 'changed' in the db, but 'updated' in the UI, however let's make comment module consistent with node module for now, then try to make them consistent internally at a later time. Also removed the $ret.
Comment #17
sunAll points covered.
Comment #19
Dries CreditAttribution: Dries commentedThanks for the reroll.
Committed to CVS HEAD!
This will require us to module update the upgrade instructions in the handbook. Marking this 'needs work'.
Comment #20
sun.
Comment #21
jeffschulerShouldn't this continue to use
:timestamp
for the placeholder in the query, since that's what thechanged
date is being checked against?This review is powered by Dreditor.
Comment #22
jeffschulerHere's the change in nomenclature I'm suggesting.
At the risk of straying off-topic,
$timestamp
is not a very informative name for the variable here. Something like$last_viewed
might be more appropriate.As Dries suggested, I've added documentation of this issue's essential change to the handbook page for Converting 6.x modules to 7.x: Comment.timestamp split into 'created' and 'changed'.
Comment #23
catchHmm, that should be causing test failures somewhere, surprised we have zero coverage for comment_num_new().
Comment #24
Dries CreditAttribution: Dries commentedCatch, the patch in #22 doesn't fix a bug. It only renames a placeholder variable. Or are you referring to something else?
Comment #25
catchReviewing patches before caffeine again :(
Comment #26
Dries CreditAttribution: Dries commentedCommitted. Thanks.
Comment #28
AlexisWilke CreditAttribution: AlexisWilke commentedInteresting that I read someone saying that D6 won't be fixed. Know that there is an enormous bug in D6 that makes comments lose their order, which was the problem spoken about in the original post here.
I have one page with ONLY 44 comments and the threads ran out of numbers!!! Yes! I get an overflow. It's all wrong.
There is the database content sorted by thread:
As you may notice, the threads are in order up to cid #85. Then #86, 99 and 88 are at the top with 00/. Any idea why?! I will tell you why. The number '5z03zz4.00.00.00.00' represents: 5970886882825090468202.
And that number + 1, to go to the next thread level is: 5.97088688283E+21.
And when you try to convert that back to a thread number it becomes 00/.
You can try that yourself:
The culprit is this code:
The $max variable is set to the entire thread value. It should be limited to the first part. There are many ways to do so, there is an example:
Now, you may skip fixing this in D6, but I can tell you that threaded comments just won't work for any D6 user that receives around 50 comments! On my end, I have to fix my database. See you later.
Thank you.
Alexis Wilke
P.S. I have version 5.2 of PHP. Maybe base_convert() in 5.3 does not accept the period? I'd be surprised though.