-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
use initial avatars instead of 'mystery person' when gravatar not set #3043
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
Conversation
Current coverage is
|
src/sentry/auth/helper.py
Outdated
| if request.user.is_authenticated(): | ||
| return self.respond('sentry/auth-confirm-link.html', { | ||
| 'identity': identity, | ||
| 'identity': InterfaceUser.to_python(identity), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not totally sure this is a good idea, so let me know if there are better ways to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you're trying to do here. This is a little odd, but we can talk about it in person since it's not 100% clear to me what made you do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically, this was a way to use the User interface's get_label and get_display_name methods, which makes passing different user-like objects into the templating function a lot easier.. but yes, should probably talk in person.
So good. Pumped to have this live. |
src/sentry/utils/avatar.py
Outdated
|
|
||
|
|
||
| def hash_user_identifier(identifier): | ||
| return sum(map(ord, identifier)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how much we care about this, but pretty sure this % 6 will not be very uniform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in the colorhash module or what it's called truncates an md5 which distributes better but is also slower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i see. We also use this in JS. Not worth the effort then.
| return ( | ||
| u'<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" {size_attrs}>' | ||
| '<rect x="0" y="0" width="120" height="120" rx="15" ry="15" fill={color}></rect>' | ||
| '<text x="50%" y="50%" font-size="65" dominant-baseline="central" text-anchor="middle" fill="#FFFFFF">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this different from what you're doing in JSX? In JSX you're doing style={{'dominantBaseline': 'central'}}, which doesn't translate to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the correct way to do this, but the version of react that we're using doesn't support the dominant-baseline svg property (it should soon, see facebook/react#5714). adding it as a style property has the same effect, so just doing that for now. i should maybe add a TODO to update the jsx version whenever we upgrade react though
08cbc20 to
1cf22cf
Compare
src/sentry/interfaces/user.py
Outdated
| 'user_username': self.username, | ||
| 'user_ip_address': self.ip_address, | ||
| 'user_data': self.data, | ||
| 'user': self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing commas in python plz. :)
|
I didn't test the email rendering, but everything else seems reasonable aside from the minor adjustments. |

fixes #2856
@getsentry/ui @mattrobenolt @dcramer