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

Gravatar support for user profile picture #3584

Merged
merged 14 commits into from Mar 8, 2021
Merged

Gravatar support for user profile picture #3584

merged 14 commits into from Mar 8, 2021

Conversation

Twixes
Copy link
Collaborator

@Twixes Twixes commented Mar 4, 2021

Changes

This makes it so that the user's Gravatar is used in the top right corner and user dropdown if available. If not available, Gravatar returns a 404 and the usual placeholder with the first letter of the user's name is shown.
Resolves #1474.

Jane

@Twixes Twixes requested a review from paolodamico March 4, 2021 21:45
@timgl timgl temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 21:48 Inactive
@Twixes Twixes changed the title Gravatar support for users Gravatar support for user profile picture Mar 4, 2021
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 21:57 Inactive
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 22:46 Inactive
@Twixes
Copy link
Collaborator Author

Twixes commented Mar 4, 2021

Now also shown in Members:

Members

@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 22:49 Inactive
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 22:51 Inactive
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 23:01 Inactive
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 23:19 Inactive
@Twixes
Copy link
Collaborator Author

Twixes commented Mar 4, 2021

Why not in Invites too:
Invites

@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 23:23 Inactive
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 4, 2021 23:26 Inactive
@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 5, 2021 14:25 Inactive
Copy link
Contributor

@paolodamico paolodamico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general lgtm and seems to work as expected (a few minor nits). Though I would strongly suggest we cache these images in the backend and fetch them from there. This will make sure we can use the images in other places well (e.g. emails), and we also avoid exposing our users to a third-party service (particularly concerned with self-hosted). Thoughts?

userEmail?: string
}

export function ProfilePicture({ userName, userEmail }: ProfilePictureProps): JSX.Element {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: userName could be confused with a username, why not just name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

"antd": "^4.11.2",
"babel-preset-nano-react-app": "^0.1.0",
"chart.js": "^2.9.3",
"core-js": "3.6.5",
"crypto-js": "^4.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be an md5 only package. Not sure if webpack optimizes the imported modules here, but might be better to avoid adding a bunch of functions we won't use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this is specifically imported in a way utilizing tree shaking to only load the single function we need :)

@Twixes Twixes temporarily deployed to posthog-gravatar-y6nkpg8mrc6k1 March 8, 2021 12:39 Inactive
@Twixes
Copy link
Collaborator Author

Twixes commented Mar 8, 2021

IMO the privacy downside in using Gravatar client-side is small enough, it's not a script or anything. And airgapped deployments are unaffected by this PR. I've filed #3595 though to solve this server-side in due time, possibly when we finally get the /api/user DRF refactor done (right now I fear we'd introduce too much tech debt by working around the provisional user endpoint).

@Twixes Twixes merged commit 6f85e8f into master Mar 8, 2021
@Twixes Twixes deleted the gravatar branch March 8, 2021 13:13
@mariusandra
Copy link
Collaborator

Gravatar is nice, though I think the biggest next win will be from getting avatars of users who log in with Google. :)

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.

Gravatar profile picture
4 participants