Skip to content

Conversation

JanCizmar
Copy link
Contributor

No description provided.

@JanCizmar JanCizmar requested a review from dkrizan August 8, 2025 07:32
Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jancizmar/react-email-default-template

Comment @coderabbitai help to get the list of available commands and usage tips.

"isCloud" to isCloud,
"instanceQualifier" to if (isCloud) tolgeeProperties.appName else tolgeeProperties.frontEndUrl.intoQualifier(),
"instanceUrl" to tolgeeProperties.frontEndUrl,
"instanceUrl" to "http://localhost:8080",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing that it makes me wonder if the issues you were experiencing are that in development the frontEndUrl points to the Vite server and it isn't configured to proxy /static/* to the backend... That'd explain it

Copy link
Collaborator

@cyyynthia cyyynthia left a comment

Choose a reason for hiding this comment

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

Leaving some feedback for consideration 😄

emailService.sendEmailTemplate(
recipient = params.to,
subject = params.subject,
template = params.templateName ?: "default",
Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW, I recon my original idea was to eventually deprecate that component; i.e. new code would use the new email system while legacy code can still use this until it is eventually migrated to use a dedicated template. Not sure templateName is needed 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

We agreed to wrap all existing emails in a default template and just drop the legacy email text into it. Since the new email designs aren’t ready yet, this lets us still use the feature in the meantime 😀

"instanceQualifier" to if (isCloud) tolgeeProperties.appName else tolgeeProperties.frontEndUrl.intoQualifier(),
"instanceUrl" to tolgeeProperties.frontEndUrl,
"instanceQualifier" to if (isCloud) tolgeeProperties.appName else backendUrl.intoQualifier(),
"backendUrl" to backendUrl
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unsure about that... Especially wrt the instance qualifier. The fallback to using the domain name people are using to access Tolgee is likely a lot more recognizable than whatever internal URL is used.

Problems in development environment are likely related to the fact I completely overlooked that and didn't add the appropriate proxy config to Vite 😅


val html = templateEngine.process(template, context)
val subject = extractEmailTitle(html)
val subject = subject ?: extractEmailTitle(html)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: Setting a subject would break internationalization of emails. I guess this is needed for the backcompat layer, but... not ideal as it makes the service contract loose here :(

I don't think the template allows the subject being a variable directly but that could be mitigated with a passthrough i18n string; i.e. email.legacy.subject-passthrough = "{subject}"

defaultValue="Welcome and thank you for creating an account!"
/>{' '}
</If.Then>
<If.Else></If.Else>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: If.Else isn't strictly mandatory; looking back at the HACKING.md note I see where it comes from but I more or less wanted to express that bare JSX as children of If isn't great because it's hard to tell what part of an if-then-else we're working with.

Empty else doesn't hurt, but omitting it is fine imho.

Copy link
Contributor

@dkrizan dkrizan Aug 19, 2025

Choose a reason for hiding this comment

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

i am afraid the reason i put it there is, that it actually didn't work without <If.Else></If.Else> 🤷‍♂️ (I guess <If.Else /> shoud be good too) .. I don't know why, I was too lazy to find out 😁

btw this template is not used anyway, so it might be deleted

Copy link
Collaborator

Choose a reason for hiding this comment

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

I initially included it as a showcase/"real-world" demo (and was the template I used while prototyping back then); but it can indeed be ditched 😅

Weird that the Else branch is required; I know for sure it didn't use to be but I might've enforced it when refactoring at some point. Not very important anyway... :)

/>
</Text>
<Text>
<If condition="${isSignup}">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure using the same template for registration and email changes is advisable (given the advanced templating system now); subject of the email might be ambiguous and it limits the extensibility of the registration email (e.g. adding additional sections such as getting started guides and what not).

The wording of the confirm-email-text is a bit confusing too; people aren't "starting to use" Tolgee but rather "changing their email" and I think the email body should reflect that.

Related to the 1st point email change confirmation (and other important emails) should perhaps contain warnings and advise caution regarding phishing campaigns and what to do in case of suspicious activity (use MFA, change passwords, etc).

@dkrizan dkrizan force-pushed the jancizmar/react-email-default-template branch from b96f7dd to 8f5ab03 Compare September 10, 2025 15:21
@dkrizan dkrizan force-pushed the cynthia/react-email branch from 954b9e4 to add5c96 Compare September 10, 2025 15:25
@dkrizan dkrizan force-pushed the jancizmar/react-email-default-template branch from 8f5ab03 to f2badad Compare September 10, 2025 15:26
@dkrizan dkrizan force-pushed the jancizmar/react-email-default-template branch from f2badad to d229261 Compare September 10, 2025 15:29
@dzienisz
Copy link
Member

@dkrizan can you add screenshot of those emails before and after the change?

Copy link
Contributor

This PR is stale because it has been open for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants