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

262 show template errors #271

Merged
merged 19 commits into from
Nov 28, 2023
Merged

262 show template errors #271

merged 19 commits into from
Nov 28, 2023

Conversation

lache-melvin
Copy link
Collaborator

@lache-melvin lache-melvin commented Nov 24, 2023

Closes #262 (this PR is part 2)

πŸ‘©πŸ»β€πŸ’» What does this PR do?

Uses the tera-web package to validate whether the templates are parse-able, and displays an error state if not. Also prevents being able to save a broken template.

Screenshot 2023-11-24 at 2 04 40 PM

Makes subject and body template fields always full width too, to prevent their width jumping around as the error shows and hides:
i.e. this closes #214
Screenshot 2023-11-24 at 2 06 49 PM

πŸ§ͺ How has/should this change been tested?

πŸ’Œ Any notes for the reviewer?

@lache-melvin lache-melvin marked this pull request as ready for review November 24, 2023 03:14
const isInvalid =
!draft.title ||
// nothing selected
!isValidTemplate(draft.subjectTemplate) ||
!isValidTemplate(draft.bodyTemplate) ||
Copy link
Collaborator Author

@lache-melvin lache-melvin Nov 27, 2023

Choose a reason for hiding this comment

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

Would we ever send a notification with a subject but no body? Or a blank subject and just a body? i.e. do both subject and body need to exist, as well as being valid, or just that they need to be valid if they do exist?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should always have a body.
Telegram only renders the body, subject is just for email in current design.

@jmbrunskill jmbrunskill self-requested a review November 28, 2023 00:16
Copy link
Collaborator

@jmbrunskill jmbrunskill left a comment

Choose a reason for hiding this comment

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

Awesome! Love it.

const isInvalid =
!draft.title ||
// nothing selected
!isValidTemplate(draft.subjectTemplate) ||
!isValidTemplate(draft.bodyTemplate) ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should always have a body.
Telegram only renders the body, subject is just for email in current design.

@lache-melvin lache-melvin merged commit 82338cb into main Nov 28, 2023
@lache-melvin lache-melvin deleted the 262-show-template-errors branch November 28, 2023 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants