fix: Fixes cc bcc being sent when mail head is empty (#3515)

* fix: Fixes cc bcc being sent wrongly with emails

* fixes values not sycned to parent component

* Update app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue

* Review fixes
This commit is contained in:
Nithin David Thomas 2021-12-07 23:44:32 +05:30 committed by GitHub
parent 46afcd9348
commit 824101bc30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 18 deletions

View file

@ -22,8 +22,8 @@
/> />
<reply-email-head <reply-email-head
v-if="showReplyHead" v-if="showReplyHead"
:clear-mails="clearMails" :cc-emails.sync="ccEmails"
@set-emails="setCcEmails" :bcc-emails.sync="bccEmails"
/> />
<resizable-text-area <resizable-text-area
v-if="!showRichContentEditor" v-if="!showRichContentEditor"
@ -142,7 +142,8 @@ export default {
mentionSearchKey: '', mentionSearchKey: '',
hasUserMention: false, hasUserMention: false,
hasSlashCommand: false, hasSlashCommand: false,
clearMails: false, bccEmails: '',
ccEmails: '',
}; };
}, },
computed: { computed: {
@ -377,7 +378,6 @@ export default {
this.showAlert(errorMessage); this.showAlert(errorMessage);
} }
this.hideEmojiPicker(); this.hideEmojiPicker();
this.clearMails = false;
} }
}, },
replaceText(message) { replaceText(message) {
@ -400,7 +400,8 @@ export default {
clearMessage() { clearMessage() {
this.message = ''; this.message = '';
this.attachedFiles = []; this.attachedFiles = [];
this.clearMails = true; this.ccEmails = '';
this.bccEmails = '';
}, },
toggleEmojiPicker() { toggleEmojiPicker() {
this.showEmojiPicker = !this.showEmojiPicker; this.showEmojiPicker = !this.showEmojiPicker;

View file

@ -55,9 +55,13 @@
import { validEmailsByComma } from './helpers/emailHeadHelper'; import { validEmailsByComma } from './helpers/emailHeadHelper';
export default { export default {
props: { props: {
clearMails: { ccEmails: {
type: Boolean, type: String,
default: false, default: '',
},
bccEmails: {
type: String,
default: '',
}, },
}, },
data() { data() {
@ -67,6 +71,18 @@ export default {
bccEmailsVal: '', bccEmailsVal: '',
}; };
}, },
watch: {
bccEmails(newVal) {
if (newVal !== this.bccEmailsVal) {
this.bccEmailsVal = newVal;
}
},
ccEmails(newVal) {
if (newVal !== this.ccEmailsVal) {
this.ccEmailsVal = newVal;
}
},
},
validations: { validations: {
ccEmailsVal: { ccEmailsVal: {
hasValidEmails(value) { hasValidEmails(value) {
@ -85,18 +101,10 @@ export default {
}, },
onBlur() { onBlur() {
this.$v.$touch(); this.$v.$touch();
this.$emit("set-emails", { bccEmails: this.bccEmailsVal, ccEmails: this.ccEmailsVal }); this.$emit('update:bccEmails', this.bccEmailsVal);
this.$emit('update:ccEmails', this.ccEmailsVal);
}, },
}, },
watch: {
clearMails: function(value){
if(value) {
this.ccEmailsVal = '';
this.bccEmailsVal = '';
this.clearMails = false;
}
}
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>