Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Bug in Private messages, previous pages of older messages cannot be accessed

edited October 2010 in Vanilla 2.0 - 2.8
It seems there is a bug in the private messaging system:

Once the amount of messages in a thread cause paging (after about 50 messages), the first 50 are hidden and an "older messages" button is used to access the previous messages.

However, clicking this button has no effect other than hiding the "older messages" button. No older messages are shown! In effect, the older items in the thread cannot be accessed at all.

First experienced this bug on another forum, but verified that the same bug appears on this very forum. If you would like to be invited to my test conversation (to avoid posting 50+ messages to yourself), just let me know. :)

Comments

  • Options
    Hrm, no response to this at all? I'm surprised that no-one else has experienced this problem.

    Either way; I spent some time trying to figure the problem out. The bug seems to be in the pager software:

    Links are at the format (link)/[OFFSET]/[LIMIT], where OFFSET is the number of items from 0 that should be hidden before the first message, and LIMIT is the maximum number of messages to display.

    Example: /messages/all/10/10 displays messages from 10 to 20.

    ("all" can be replaced by the index of a conversation).

    Now, the "Newer Messages" link is something like:

    /messages/all/20/20

    And this will add (using AJAX) another 20 messages starting from message number 20.

    The bug is in the "Older Messages" link, because the generated code is:

    /messages/all/0/0

    Which means: "Please read 0 of the old messages starting from 0, and prepend those using Ajax". Of couse, prepending 0 messages has no effect as all.

    ---

    I hope this makes sense to someone who can fix this easily, finding the bug without knowing PHP or vanilla is... hard.

  • Options
    I'm getting closer;

    vanilla2/applications/dashboard/modules/class.morepagermodule.php line 207 and onwards creates the faulty link, and adding a small offset to the previousRecords argument on line 222 affects the link accordingly, but haven't figured the details yet (and have to stop for now).
  • Options
    edited October 2010
    Ok, to all my waiting fans out there; I solved it!


    The following line (188) in applications/dashboard/modules/class.morepagermodule.php:

    // Urls with url-encoded characters will break sprintf, so we need to convert them for backwards compatibility. $this->Url = str_replace(array('%1$s', '%2$s', '%s'), '{Page}', $this->Url);

    Should be replaced with:

    //Urls with url-encoded characters will break sprintf, so we need to convert them for backwards compatibility. $this->Url = str_replace(array('%1$s', '%s'), '{Page}', $this->Url); $this->Url = str_replace(array('%2$s'), '{Size}', $this->Url);

    This is because the Offset and Limit parameters mentioned before (%1$s and %2$s) are both replaced with the "{Page}" block in the original code, while the second parameter should be replaced with the "{Size}" block.

    I have no idea where the "%s" character is used, so I haven't touched that one.

    I just now noticed the git-hub issue reporter, so I've supplied the fix there.
  • Options
    I experienced the same problem.
    Your Bugfix seems to work!
Sign In or Register to comment.