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

Enh/add recipient on blur #9566

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Enh/add recipient on blur #9566

wants to merge 4 commits into from

Conversation

GVodyanov
Copy link
Contributor

Fix #9452

Adds mail recipients automatically when the NcSelect is deselected

Comment on lines 1228 to 1237
if (
(option === null || option === undefined)
&& this.recipientSearchTerms[type] !== undefined
&& this.recipientSearchTerms[type] !== ''
) {
option = {}
option.email = this.recipientSearchTerms[type]
option.label = this.recipientSearchTerms[type]
this.recipientSearchTerms[type] = ''
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand this trick. Is this for when you leave the input when a suggestion is shown in the dropdown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Took me a while to remember what was going on here too 😅


So (option === null || option === undefined) is needed because that function is called in two cases:

  1. You selected one of the suggested options from the dropdown
  2. You click outside the dropdown, so the recipient is added anyway

If you were to click on the dropdown without this check it would fire twice, once for the selection of the dropdown (@option:selecting), and once for the click closing the dropdown (@search:blur).


&& this.recipientSearchTerms[type] !== undefined
&& this.recipientSearchTerms[type] !== ''

Just normal checks


option = {}
option.email = this.recipientSearchTerms[type]
option.label = this.recipientSearchTerms[type]

Overriding the option parameter with not the dropdown content but the string content of the search of the NcSelect

this.recipientSearchTerms[type] = ''

Resetting the string content of the search of the NcSelect seeing as that string has already been added as a recipient

Hope this clears things up @ChristophWurst :)

Copy link
Contributor

@hamza221 hamza221 left a comment

Choose a reason for hiding this comment

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

Tested ✅ maybe as a followup we check if the value is in email format, before adding the address

src/components/Composer.vue Outdated Show resolved Hide resolved
@GVodyanov
Copy link
Contributor Author

Tested ✅ maybe as a followup we check if the value is in email format, before adding the address

Right, do we have a specific function for that? I wasn't able to find anything but it feels like we should have a standard for that, currently I just inserted a check on the @ character.

Also an issue I'm encountering is the search term being cleared even if the term wasn't added to the email list, I will investigate it further later but it's a little weird.

Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
@hamza221
Copy link
Contributor

I wrote a little hacky work-arround, But idk if it's really necessary. what do you think @ChristophWurst?
Feel free to discard it, If you find a better way

@GVodyanov
Copy link
Contributor Author

I wrote a little hacky work-arround, But idk if it's really necessary. what do you think @ChristophWurst? Feel free to discard it, If you find a better way

Peek 2024-05-28 18-07
Tested it, works well, and in my opinion it would do @hamza221

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

Successfully merging this pull request may close these issues.

Apply recipient search input on blur
3 participants