zulip/zulip-flutter

Handle avatar-URL optimization `user_avatar_url_field_optional`

已關閉

#254 建立於 2023年8月3日

 (3 則留言) (0 個反應) (0 位負責人)Dart (456 個分叉)github user discovery
a-apihelp wantedperformance

倉庫指標

星標
 (454 顆星)
PR 合併指標
 (平均合併 25天 15小時) (30 天內合併 22 個 PR)

描述

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.

貢獻者指南