Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use deterministic avatars for channel members #61

Merged
merged 3 commits into from
Jun 14, 2022

Conversation

oliverlaz
Copy link
Member

@oliverlaz oliverlaz commented Jun 13, 2022

Goal

Under some circumstances, the avatars of the members in a channel were selected randomly and in unpredictable fashion.
This behavior can be annoying sometimes especially when testing the multi-user chat channels.

With this PR, the selection of avatars is made a bit more deterministic and relies on the user_id parameter.

Implementation details

  • we calculate a hash value for the given user_id (should be stable enough for testing/demo purposes)
  • based on the hash value, we assign an avatar to the user from our list of predefined avatars

heuristically assigns avatar images based on user's id hash code
@oliverlaz oliverlaz merged commit 292e154 into master Jun 14, 2022
@oliverlaz oliverlaz deleted the fix/improvements branch June 14, 2022 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants