I previously had this issue. It only affects admins who have the rights to change the order of the pinned topics which is why it's unlikely others can't reproduce on the OPs site.
However since 1.7 (could be Chrome 64) I no longer have the problem.
"messages:uid:fromuid:to:touid" not working as expected?
-
Hi, @psychobunny helped me set up my first plugin that will grab/record chat statistics (ex. how many times user1 has messaged user2). I believe NodeBB attempts to record that information here but a bug is keeping it from doing it correctly. I'm guessing it's cause the uids[] array is sorted. So for example, if user1 (uid:1) sends a message to user2 (uid:2), NodeBB correctly saves it into "messages:uid:1:to:2" but now if user2 sends a message to user1, NodeBB again saves it into "messages:uid:1:to:2" even though it's suppose to be "messages:uid:2:to:1". I went ahead and replaced that line with this one "async.apply(db.sortedSetAdd, 'messages:uid:' + fromuid + ':to:' + touid, timestamp, mid)" and it seems like it's working correctly now. Is that the correct/safe way to fix the bug?
-
No, when uid 1 and uid 2 are having a conversation all the messages are saved in
messages:uid:' + uids[0] + ':to:' + uids[1]
the uids array is populated at the top of that function withvar uids = sortUids(fromuid, touid);
so the lower uid is always the first. -
ohh ok.. I just thought the other way made more sense since user2 sent the message "to" user1. so saving it as "user2:to:user1" instead of "user1:to:user2" was more intuitive. sorry