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

Display title of current organization in confirmation dialog #2404

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

helihard
Copy link
Collaborator

@helihard helihard commented Dec 4, 2024

Description

This PR displays the name of the current organization in the confirmation dialog on selecting delete event type from an event.

Screenshots

confirmation-dialog-1
confirmation-dialog-2

Changes

  • Displays the name of the current organization in the confirmation dialog.
  • Displays a default message should the name of the current organization be null or undefined.

Notes to reviewer

Not at all sure this is a good solution, even if it seems to work as intended on my end. If not, I would be happy for a hint about the right direction.

Related issues

Resolves #2400

Copy link
Member

@richardolsson richardolsson left a comment

Choose a reason for hiding this comment

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

Nice work! I think your solution is very clever, but I don't think we need to be that clever. Could we try to simplify the solution?

deleteMessage: m<{ eventType: string }>(
'Are you sure you want to delete the "{eventType}" event type for the whole organization?'
currentDefaultOrgMsg: m('the current organization'),
deleteMessage: m<{ eventType: string; orgTitle: string }>(
Copy link
Member

Choose a reason for hiding this comment

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

Changing a message like this (adding properties) is risky, because there might be translations that don't include the property. I think we should give the message a new name.

@@ -250,6 +253,7 @@ const EventTypeAutocomplete: FC<EventTypeAutocompleteProps> = ({
},
warningText: messages.type.deleteMessage({
eventType: option.title,
orgTitle: orgTitle ? orgTitle : currentDefaultOrgMsg,
Copy link
Member

Choose a reason for hiding this comment

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

Under no normal circumstances should orgTitle be undefined on this page. If it is, it should be temporary (while loading) and I'm thinking we can fallback to an empty string or something. That way, we don't need to have two separate messages.

Copy link
Member

@richardolsson richardolsson left a comment

Choose a reason for hiding this comment

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

The preview build works as expected and the code looks good as well. Nice work! 💯

@richardolsson richardolsson merged commit dc5b151 into main Dec 9, 2024
6 checks passed
@richardolsson richardolsson deleted the issue-2400/event-type-deletemessage branch December 9, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"The whole organization" misleading when deleting type
2 participants