Fix viewer showing wrong user for single-DM exports#655
Merged
rusq merged 2 commits intorusq:masterfrom Mar 29, 2026
Merged
Conversation
mostFrequentMember uses map iteration to find the current user among DM members. When there is only one DM (or a tie in frequency counts), Go's non-deterministic map ordering can pick either member, causing the viewer to display the current user's name instead of the other person's name. Break the tie by selecting the last member of the first DM entry, which matches slackdump's export ordering of [other_user, current_user].
Owner
|
Hey @shehrozsheikh , thanks for the fix. I added a normalisation to ensure that "me" always stays last at the time when "me" is known. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #654.
mostFrequentMemberrelies on Go map iteration order to find the current user. With a single DM, both members have frequency 1 and the result is non-deterministic. This breaks the viewer sidebar display about half the time.When a tie is detected, this falls back to the last member of the first DM entry, which matches slackdump's export ordering (
[other_user, current_user]fromconvertToDM).Added two test cases for the tie-breaker path.