-
Notifications
You must be signed in to change notification settings - Fork 245
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Grigory Vodyanov <scratchx@gmx.com>
src/components/Composer.vue
Outdated
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] = '' | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- You selected one of the suggested options from the dropdown
- 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 :)
There was a problem hiding this 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
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 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>
I wrote a little hacky work-arround, But idk if it's really necessary. what do you think @ChristophWurst? |
|
Fix #9452
Adds mail recipients automatically when the NcSelect is deselected