self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

Inconsistent email subject formatting

Open leeoocca opened this issue 9 months ago • 8 comments

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

Steps to Reproduce

  1. Navigate to sentry.example.com/settings/account/emails/
  2. Click on Resend verification

Likely the problem is this formatting string:

https://github.com/getsentry/sentry/blob/dc7f8f8fe8ef0b67db7550815cde9cf61204a009/src/sentry/users/models/user.py#L293

or this one:

https://github.com/getsentry/sentry/blob/dc7f8f8fe8ef0b67db7550815cde9cf61204a009/src/sentry/users/models/user.py#L318


After a simple search in the repo, many other email notifications face the same issue:

https://github.com/getsentry/sentry/blob/dc7f8f8fe8ef0b67db7550815cde9cf61204a009/src/sentry/auth/idpmigration.py#L89

https://github.com/getsentry/sentry/blob/dc7f8f8fe8ef0b67db7550815cde9cf61204a009/src/sentry/api/endpoints/project_transfer.py#L109

https://github.com/getsentry/sentry/blob/dc7f8f8fe8ef0b67db7550815cde9cf61204a009/src/sentry/api/endpoints/secret_scanning/github.py#L155

https://github.com/getsentry/sentry/blob/dc7f8f8fe8ef0b67db7550815cde9cf61204a009/src/sentry/api/endpoints/organization_details.py#L1168


Full search: https://github.com/search?q=repo%3Agetsentry%2Fsentry%20mail.subject-prefix&type=code

It's not a show-stopper, but would make the product more polished. I can start a PR if you want.

Expected Result

Subject: [Sentry] Confirm Email

Actual Result

Subject: [Sentry]Confirm Email

Product Area

Other

Link

No response

DSN

No response

Version

25.1.0

leeoocca avatar Feb 13 '25 14:02 leeoocca

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] avatar Feb 13 '25 14:02 getsantry[bot]

You can submit a PR to the getsentry/sentry repo. Link this issue to your PR later.

aldy505 avatar Feb 20 '25 02:02 aldy505

Uhmm, I was just thinking... What happens if someone has the mail.subject-prefix set to an empty string ""?

What approach do you suggest to avoid having a leading space in the subject in that case? Should we add the space to the prefix itself?

leeoocca avatar Feb 20 '25 14:02 leeoocca

How can I link it to this issue? Here it is: https://github.com/getsentry/sentry/pull/85540

leeoocca avatar Feb 20 '25 15:02 leeoocca

Uhmm, I was just thinking... What happens if someone has the mail.subject-prefix set to an empty string ""?

What approach do you suggest to avoid having a leading space in the subject in that case? Should we add the space to the prefix itself?

@aldy505 should I add a trailing space to the prefix? This is the only simple solution I see for now.

leeoocca avatar Feb 21 '25 16:02 leeoocca

Uhmm, I was just thinking... What happens if someone has the mail.subject-prefix set to an empty string ""? What approach do you suggest to avoid having a leading space in the subject in that case? Should we add the space to the prefix itself?

@aldy505 should I add a trailing space to the prefix? This is the only simple solution I see for now.

@leeoocca I think it would be better if you trim the value if exists and put a suffix space. Something like this:

subject="{}Confirm Email".format(options.get("mail.subject-prefix").strip() + " " if not options.get("mail.subject-prefix") else ""),

aldy505 avatar Feb 24 '25 02:02 aldy505

I think it would be better if you trim the value if exists and put a suffix space

I though something similar, but I'm afraid of all the boilerplate it adds every time you want to compose an email subject. Isn't there a better way to abstract it? Maybe an own function?

leeoocca avatar Feb 24 '25 09:02 leeoocca

I think it would be better if you trim the value if exists and put a suffix space

I though something similar, but I'm afraid of all the boilerplate it adds every time you want to compose an email subject. Isn't there a better way to abstract it? Maybe an own function?

It should be up to you! See Sentry's philosophy here if you haven't read this (I'm not an employee and this is actually a good read): https://develop.sentry.dev/getting-started/philosophy/

aldy505 avatar Feb 25 '25 15:02 aldy505

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Aug 12 '25 07:08 getsantry[bot]