Inbox sort wrong after Import

I have had some users complain that the order that their inbox is in is completely random and not in date ordered. Is there an easy way to fix this?

Comments

  • So its weird every time i refresh the page the most recent conversation stays at the top and all the ones below it change on every page refresh.. I was looking at the class.conversationmodel.php file and the two fnction

    get2 and getInbox both of them seems right but weird things happen when i test ASC for the sort order like every page refresh every message is different on each refresh! Anyone have a clue what might be going on and why only the most recent message created on Vanilla is fine but all the older messages are just in random order on ever refresh? I have checked and all the messages in question have different dates on them

  • Is there a built in function to Vanilla that i can show an object in the console so that i can open it up and browse it?

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Instead of searching for ways to tweak Vanilla, I would suggest to fix the import ;-)

    Looking at the structure.php of the Conversations application, you will see that there are only three tables included which will make corrections feasible.


    That would "suggest" corrected ConversationIDs. I would run and export this and a similar query for GDN_ConversationMessage as an additional backup reference.

    SELECT ConversationID, DateInserted, @rownum := @rownum + 1 AS NewConversationID
    FROM GDN_Conversation c,
    (SELECT @rownum := 0) r
    ORDER BY DateInserted
    


    After that you can run an update queries on the tables. You need to start by changing the ConversationMessageIDs of UserConversation and Conversatio and in the last step in the ConversationMessage table.

    The the same for the ConversationIDs and also use the "parrent" table of that value as the last table to change. An update query would look like that:

    UPDATE
     GDN_UserConversation uc
     , (
       SELECT
        MessageID
        , @rownum := @rownum + 1 AS NewMessageID
       FROM
        GDN_ConversationMessage
        , (SELECT @rownum := 0) r
       ORDER BY
        DateInserted
     ) id
    
    SET uc.LastMessageID = id.NewMessageID
    WHERE uc.LastMessageID = id.MessageID
    


    It goes without saying that you must be super careful since errors could expose messages to the wrong persons. And during the complete re-indexing process no one should be able to access private messages.


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    For that you would need a browser extension like FirePHP.

    But there are also php only solutions like debugbar. That would make an interesting plugin ;-)


  • I see where you are going with that smiley face :)

    I am not trying to tweak it per say but more trying to figure out how every time I refresh the page all the data is different other then the very 1st one that was made on Vanilla the others were imported. How is it possible to run the same query 5 times and get data different each time? especially with a sortby? How is this even possible?

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator
Sign In or Register to comment.