fix: Add a check for 24 hour window before sending a message (#1084)

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S 2020-07-25 22:54:45 +05:30 committed by GitHub
parent 12ee7e5d82
commit 0f2d3418f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 292 additions and 9 deletions

View file

@ -108,7 +108,7 @@ export default {
data() {
return {
message: '',
isPrivate: false,
isPrivateTabActive: false,
isFocused: false,
showEmojiPicker: false,
showCannedResponsesList: false,
@ -117,6 +117,12 @@ export default {
},
computed: {
...mapGetters({ currentChat: 'getSelectedChat' }),
isPrivate() {
if (this.currentChat.can_reply) {
return this.isPrivateTabActive;
}
return true;
},
inboxId() {
return this.currentChat.inbox_id;
},
@ -214,6 +220,13 @@ export default {
},
},
watch: {
currentChat(conversation) {
if (conversation.can_reply) {
this.isPrivateTabActive = false;
} else {
this.isPrivateTabActive = true;
}
},
message(updatedMessage) {
if (this.isPrivate) {
return;
@ -278,11 +291,11 @@ export default {
}, 100);
},
setPrivateReplyMode() {
this.isPrivate = true;
this.isPrivateTabActive = true;
this.$refs.messageInput.focus();
},
setReplyMode() {
this.isPrivate = false;
this.isPrivateTabActive = false;
this.$refs.messageInput.focus();
},
emojiOnClick(emoji) {
@ -327,7 +340,10 @@ export default {
}
this.isUploading = true;
this.$store
.dispatch('sendAttachment', [this.currentChat.id, { file: file.file }])
.dispatch('sendAttachment', [
this.currentChat.id,
{ file: file.file, isPrivate: this.isPrivate },
])
.then(() => {
this.isUploading = false;
this.$emit('scrollToMessage');