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

View file

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