Skip to content

Handle avatar-URL optimization user_avatar_url_field_optional #254

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

Open
gnprice opened this issue Aug 3, 2023 · 2 comments
Open

Handle avatar-URL optimization user_avatar_url_field_optional #254

gnprice opened this issue Aug 3, 2023 · 2 comments
Labels
a-api Implementing specific parts of the Zulip server API help wanted performance Smooth and responsive UI; fixing jank, stutters, and lag

Comments

@gnprice
Copy link
Member

gnprice commented Aug 3, 2023

That is, the user_avatar_url_field_optional client capability in the Zulip API:
https://zulip.com/api/register-queue#parameter-client_capabilities

At the moment, we claim that capability in our registerQueue requests; but we don't actually implement what we need on our side in order to handle it, so we end up with missing avatars. We'll shortly flip that so that we no longer claim the capability, getting correct behavior. But then we should actually implement the logic (there's not much to it), and re-enable the optimization.

For how the implementation can work, see FallbackAvatarURL in zulip-mobile's src/utils/avatar.js. In particular see validateAndConstructInstance and get. I think we can probably do the implementation with less code than is in zulip-mobile, though.

At the moment our User.avatarUrl field gets deserialized in a way that doesn't distinguish whether the server left avatar_url out or set it to null. We'll need to distinguish those in order to handle client_gravatar (a separate issue)… but the fallback avatar URLs should work for all users. So for this issue we should be fine without that distinction.

@gnprice gnprice added the a-api Implementing specific parts of the Zulip server API label Aug 3, 2023
@gnprice gnprice added this to the Launch milestone Sep 14, 2023
@gnprice
Copy link
Member Author

gnprice commented Sep 23, 2023

We'll shortly flip that so that we no longer claim the capability, getting correct behavior.

(This was done in caa9603 in #249. Implementing the optimization, which is what the present issue is about, is still open.)

@gnprice gnprice added the performance Smooth and responsive UI; fixing jank, stutters, and lag label Nov 18, 2023
@gnprice gnprice modified the milestones: Launch, Post-launch Nov 21, 2024
@NishchayRajput
Copy link

Hi, I noticed that this issue is mentioned inside Zulip Flutter. Should the fix be implemented in Zulip Flutter or Zulip Mobile?
Since the reference code (FallbackAvatarURL) is from Zulip Mobile, should we replicate a similar implementation in Zulip Flutter, or does it need changes in both apps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-api Implementing specific parts of the Zulip server API help wanted performance Smooth and responsive UI; fixing jank, stutters, and lag
Projects
Status: No status
Development

No branches or pull requests

2 participants