From 52a88fa99ad58aba60a72da2a82c9ce6bffc041b Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Tue, 18 Aug 2020 11:52:27 -0700 Subject: [PATCH] getMessages: Send `client_gravatar`. I'd thought we were already doing this, but apparently not. See doc at https://zulipchat.com/api/get-messages#parameters. --- src/api/messages/getMessages.js | 1 + src/utils/avatar.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/api/messages/getMessages.js b/src/api/messages/getMessages.js index ca73fc5f4c8..a37a4859ba7 100644 --- a/src/api/messages/getMessages.js +++ b/src/api/messages/getMessages.js @@ -100,6 +100,7 @@ export default async ( num_after: numAfter, apply_markdown: true, use_first_unread_anchor: useFirstUnread, + client_gravatar: true, }); return migrateResponse(response, identityOfAuth(auth)); }; diff --git a/src/utils/avatar.js b/src/utils/avatar.js index ef7480ec13b..49a117522b5 100644 --- a/src/utils/avatar.js +++ b/src/utils/avatar.js @@ -28,16 +28,16 @@ export class AvatarURL { // this case; it should be pretty rare. return GravatarURL.validateAndConstructInstance({ email }); } else if (rawAvatarUrl === null) { - // If we announce `client_gravatar`, which we sometimes do, - // `rawAvatarUrl` might be null. In that case, we take - // responsibility for computing a hash for the user's email and - // using it to form a URL for an avatar served by Gravatar. + // If we announce `client_gravatar`, which we do, `rawAvatarUrl` + // might be null. In that case, we take responsibility for + // computing a hash for the user's email and using it to form a + // URL for an avatar served by Gravatar. return GravatarURL.validateAndConstructInstance({ email }); } else if (typeof rawAvatarUrl === 'string') { - // If we don't announce `client_gravatar` (which we sometimes - // do), or if the server doesn't have - // EMAIL_ADDRESS_VISIBILITY_EVERYONE set, then `rawAvatarUrl` - // will be the absolute Gravatar URL string. + // If we don't announce `client_gravatar` (which we do), or if + // the server doesn't have EMAIL_ADDRESS_VISIBILITY_EVERYONE + // set, then `rawAvatarUrl` will be the absolute Gravatar URL + // string. // // (In the latter case, we won't have real email addresses with // which to generate the correct hash; see