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

Give clients avatar URLs for rooms #208

Merged
merged 13 commits into from
Jul 19, 2023
Merged

Give clients avatar URLs for rooms #208

merged 13 commits into from
Jul 19, 2023

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented Jul 18, 2023

This corresponds to the MSC change matrix-org/matrix-spec-proposals@50ae2c8...912621b.

Supersedes #203.
Closes #166.

Includes opinionated changes to the test helpers.

Sticky bits:

  • the machinery of which avatar to use and when
  • having a type that json-serialises to an optional nullable string is awkward
  • avoid the copy-slices-with-same-backing array problem
  • a test case failure I can fix but cannot understand

I have chosen to deliberately ignore changes to the DM flag. In fact, I don't think CalculateAvatar even reads the DM flag. I expect this will be good enough for a first pass.

Strongly recommend reviewing commit-by-commit.

David Robertson added 11 commits July 18, 2023 10:36
- Print it out in red so you can spot it easily in a long test log
- Pretty print the response json, because life's too short to train your
  brain to be a JSON parser.
Expose this on CSAPI for tests to use too.

Also update SlidingSyncUntilMembership to check the membership only.
Otherwise it would try to match an avatar. In 99% of cases this would be
fine, but things like per-room avatars (or indeed per-room displaynames)
would screw this up.
Otherwise you end up with two slices that share ownership of the same
data but don't coordinate between one another, see e.g.
https://go.dev/play/p/uk3o652Tvye
@DMRobertson DMRobertson changed the title WIP avatars 2 Give clients avatar URLs for rooms Jul 18, 2023
@DMRobertson DMRobertson marked this pull request as ready for review July 18, 2023 13:04
@DMRobertson DMRobertson linked an issue Jul 18, 2023 that may be closed by this pull request
internal/roomname.go Show resolved Hide resolved
internal/roomname.go Show resolved Hide resolved
internal/roomname.go Show resolved Hide resolved
sync3/caches/user.go Outdated Show resolved Hide resolved
testutils/m/match.go Show resolved Hide resolved
testutils/m/match.go Show resolved Hide resolved
@DMRobertson DMRobertson merged commit 81b187d into main Jul 19, 2023
6 checks passed
@DMRobertson DMRobertson deleted the dmr/avatars2 branch July 19, 2023 12:18
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.

DMs should display the opposing member's avatar
2 participants