Skip to content

Conversation

@ceorourke
Copy link
Member

@ceorourke ceorourke commented Nov 6, 2023

Fix broken user avatars in note emails - they currently always look like this with the question mark:

note-activity-broken-avatar

But after the fix they look like this:
(with a letter avatar)
note-activity-letter-avatar
(with an uploaded image avatar)
note-activity-uploaded-avatar

description_as_html works well for most other activity (aka workflow) notifications because it expects to be passed a template string that it fills in and formats as HTML, but for note activity notifications (aka comments) there is no template string, it just needs to render the comment that was left on the issue. Also because of a different design, I needed to rewrite building up the avatar HTML because other workflow notifications (like resolving an issue, for example) render the user avatar and email address on the same line as the text and that's added in the template like this:
Screenshot 2023-11-06 at 1 09 52 PM
but for note activity notifications, the title has the email address of the user who commented on the issue, and then the description needs to render only the user avatar and then the comment.

Fixes #58420

@ceorourke ceorourke requested a review from a team as a code owner November 6, 2023 22:25
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 6, 2023
def get_message_description(self, recipient: RpcActor, provider: ExternalProviders) -> Any:
return self.get_context()["text_description"]

def description_as_html(self, description: str, params: Mapping[str, Any]) -> SafeString:
Copy link
Member Author

Choose a reason for hiding this comment

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

description and params aren't actually needed here, but that's what the base function accepts. It's funny that we don't need description because that's the comment itself, but in the template (note.html) it's rendered from data.text.

@ceorourke ceorourke merged commit 51b6f61 into master Nov 6, 2023
@ceorourke ceorourke deleted the ceorourke/fix-user-avatar-emails branch November 6, 2023 23:36
ceorourke added a commit that referenced this pull request Nov 7, 2023
A follow up to #59486 after I
noticed the uploaded image avatars were looking rough.

**Before**
<img width="542" alt="Screenshot 2023-11-07 at 10 57 10 AM"
src="https://github.com/getsentry/sentry/assets/29959063/336db04b-0843-4b29-a6bc-fcfa942128d6">

**After**
<img width="544" alt="Screenshot 2023-11-07 at 10 54 46 AM"
src="https://github.com/getsentry/sentry/assets/29959063/30c5edd9-ae1e-483f-9809-78bf67a138ac">
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User avatars don't show in emails

3 participants