Comment threads not incrementing

johnskulski - October 13, 2008 - 21:31
Project:Drupal
Version:7.x-dev
Component:comment.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I was apply this test (#296485: TestingParty08: comments as replies to other comments) during the BADcamp testing party and noticed a bug. It seemed that threading was not growing as it should and was also resulting in php reporting a bad offset in comment.module:732

After digging around a bit, it seems the mysql query was only ever grabbing the parent's thread, and not the maximum string in the thread, so it never incremented the post count. The problem was in sql query that grabs the MAX(thread), it needed to know it was looking for the maximum in the children of the parent.

originally
...thread LIKE '08.01%'

mysql> SELECT subject, comment, thread FROM comments WHERE nid = 6;
+---------+--------------------+--------+
| subject | comment | thread |
+---------+--------------------+--------+
| c1 | Comment 1 | 01/ |
| c1.c1 | first reply of c1 | 01.01/ |
| c1.c2 | second reply of c1 | 01.01/ |
....
+---------+--------------------+--------+

After patch (which is a period in the right place :)
... thread LIKE '08.01.%'

mysql> SELECT subject, comment, thread FROM comments WHERE nid = 6 and thread LIKE '02%';
+-----------+------------------------+-----------+
| subject | comment | thread |
+-----------+------------------------+-----------+
| Comment 2 | second comment | 02/ |
| c2.c1 | first reply of c2 | 02.00/ |
| c2.c2 | second reply | 02.01/ |
| c2.c1.c1 | first reply of a c2.c1 | 02.00.00/ |
| c2.c1.c2 | second reply of c2.c1 | 02.00.01/ |
+-----------+------------------------+-----------+

Threads correctly. Submitting for review.

AttachmentSize
comment.module.threading.d7.patch1000 bytes

#1

Damien Tournoud - October 13, 2008 - 21:40
Status:needs review» reviewed & tested by the community

This is a regression introduced by the big DB:TNG patch (this commit). The test for it is #296485: TestingParty08: comments as replies to other comments. Restores the previous behavior, ready to be committed.

#2

Dries - October 14, 2008 - 20:35
Status:reviewed & tested by the community» fixed

This looks good, and it does isolate a problem. Committed to CVS HEAD. Thanks.

#3

Anonymous (not verified) - October 28, 2008 - 20:42
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.