Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Wierd bug when viewing discussions.

so, i've been seeing this bug from time to time, and i finally figured out when it happens, (no idea why though).
when a page in a thread is full, i.e. it has the max. number of comments allowed (50) and i click on the link for the thread from the homepage, the page doesn't display ANY comments, like this:
Photobucket - Video and Image Hosting

but if i go back a page in the thread, and then click on the 'next page' link, it shows up normally.

has anyone else had this problem? is there a fix?

Comments

  • That is odd... Is the URL any different than it is when the page loads normally? I can get a similar effect by mucking with the URL, but it doesn't show numbered pages like in your screenshot: http://lussumo.com/community/discussion/4741/2/wierd-bug-when-viewing-discussions/#Item_0 I also wonder what is numbered 3300--topics or comments? Maybe Vanilla is tripping up by mistaking all comments belong in one 66-page thread %-/ Are you using friendly URLs? And what version of MySQL? I've got a hunch it's a MySQL query gone awry.
  • edited December 2006
    the url seems normal, but ill look more closely next time i see it happening.

    the 3300 is comments. its a big thread :)

    i am not using friendly urls.

    not sure what version of mysql i am running, just sent an email to my server guy to ask, ill let you know.
  • it is my sql 4.0
  • edited December 2006
    I did some poking around and couldn't duplicate the issue, but I suspect it has something to do with some inconsistent information between what the discussions page thinks is the last comment and which really is.

    Try comparing these queries, they should both come up equal:SELECT COUNT(*) FROM LUM_Comment WHERE WhisperUserID = 0 AND DeleteUserID = 0 AND Discussion_ID = 123 SELECT CountComments FROM LUM_Discussion WHERE DiscussionID = 123

    Where 123 is the offending discussion ID. If they are not equal, set CountComments equal to the result from the first query.

    EDIT: It looks like I found the cause: If a user edits a post from public to a whisper, CountComments in the Discussion table is not decremented like it is when a post is deleted. This isn't normally a problem until the discussion grid tries to calculate which page is the last page in a discussion.
  • ah.. is there anything i can do about this, or is this just something that will be fixed in a later version of vanilla?
  • wow wall phone u have talent. i never in 100000 yeas would have figured that out lol.
  • edited December 2006
    I'll see about getting a patch to Mark for the next version, and will post it here for anybody else who bumps into this.

    Edit: It looks like whispers are usually handled OK, except when you edit a deleted whisper to add/remove the 'whisper to' contents.

    I've discovered that deleting a comment will re-sync the counts, so deleting then undeleting any comment in an affected discussion should fix any threads you see this happening in.
  • Here's a fix, near line 427 of library/vanilla/Vanilla.Class.CommentManager.php
    					// Get information about the comment being edited
  • you rock! Thanks!!!
  • Hey. i applied your patch but the bug is still happening. any other ideas?
  • edited December 2006
    The counts are probably still out of sync, since the fix only prevents the count from becoming out of sync. Try deleting a comment in the affected thread then undelete it. That should force the counts to re-sync. Oh, and make sure that you have the 'deleted comments visible' preference turned on so that you can undelete it!
  • MarkMark Vanilla Staff
    Added this to the core...
This discussion has been closed.