Skip to content

Commit

Permalink
fix: disable multiple files for whatsapp
Browse files Browse the repository at this point in the history
  • Loading branch information
clairton committed Sep 20, 2024
1 parent de1cc57 commit 38ba798
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,7 @@ export default {
return !this.isOnPrivateNote && this.isAnEmailChannel;
},
enableMultipleFileUpload() {
return (
this.isAnEmailChannel ||
this.isAWebWidgetInbox ||
this.isAPIInbox ||
this.isAWhatsAppChannel
);
return this.isAnEmailChannel || this.isAWebWidgetInbox || this.isAPIInbox;
},
isSignatureEnabledForInbox() {
return !this.isPrivate && this.sendWithSignature;
Expand Down Expand Up @@ -900,6 +895,10 @@ export default {
});
},
attachFile({ blob, file }) {
if (!this.enableMultipleFileUpload && this.attachedFiles.length > 0) {
useAlert(this.$t('CONVERSATION.REPLYBOX.TIP_ATTACH_SINGLE'));
return;
}
const reader = new FileReader();
reader.readAsDataURL(file.file);
reader.onloadend = () => {
Expand Down
1 change: 1 addition & 0 deletions app/javascript/dashboard/i18n/locale/en/conversation.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"TIP_FORMAT_ICON": "Show rich text editor",
"TIP_EMOJI_ICON": "Show emoji selector",
"TIP_ATTACH_ICON": "Attach files",
"TIP_ATTACH_SINGLE": "You cannot attach more files to this message",
"TIP_AUDIORECORDER_ICON": "Record audio",
"TIP_AUDIORECORDER_PERMISSION": "Allow access to audio",
"TIP_AUDIORECORDER_ERROR": "Could not open the audio",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/dashboard/i18n/locale/pt/conversation.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"TIP_FORMAT_ICON": "Mostrar editor de texto completo",
"TIP_EMOJI_ICON": "Mostrar selecionador de emojis",
"TIP_ATTACH_ICON": "Anexar ficheiros",
"TIP_ATTACH_SINGLE": "Você não pode adicionar mais de um arquivo para essa mensagem",
"TIP_AUDIORECORDER_ICON": "Gravar áudio",
"TIP_AUDIORECORDER_PERMISSION": "Permitir acesso ao áudio",
"TIP_AUDIORECORDER_ERROR": "Não foi possível abrir o áudio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"TIP_FORMAT_ICON": "Mostrar editor de texto completo",
"TIP_EMOJI_ICON": "Mostrar seletor de emoji",
"TIP_ATTACH_ICON": "Anexar arquivos",
"TIP_ATTACH_SINGLE": "Você não pode adicionar mais de um arquivo para essa mensagem",
"TIP_AUDIORECORDER_ICON": "Gravar áudio",
"TIP_AUDIORECORDER_PERMISSION": "Permitir acesso ao áudio",
"TIP_AUDIORECORDER_ERROR": "Não foi possível abrir o áudio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,21 @@ export default {
this.selectedInbox.inbox.channel_type === INBOX_TYPES.WEB
);
},
isAPIInbox() {
return (
this.selectedInbox &&
this.selectedInbox.inbox.channel_type === INBOX_TYPES.API
);
},
isEmailOrWebWidgetInbox() {
return this.isAnEmailInbox || this.isAnWebWidgetInbox;
},
hasWhatsappTemplates() {
return !!this.selectedInbox.inbox?.message_templates;
},
enableMultipleFileUpload() {
return this.isAnEmailInbox || this.isAnWebWidgetInbox || this.isAPIInbox;
},
hasAttachments() {
return this.attachedFiles.length;
},
Expand Down Expand Up @@ -223,6 +232,10 @@ export default {
});
},
attachFile({ blob, file }) {
if (!this.enableMultipleFileUpload && this.attachedFiles.length > 0) {
useAlert(this.$t('CONVERSATION.REPLYBOX.TIP_ATTACH_SINGLE'));
return;
}
const reader = new FileReader();
reader.readAsDataURL(file.file);
reader.onloadend = () => {
Expand Down Expand Up @@ -495,7 +508,7 @@ export default {
input-id="newConversationAttachment"
:size="4096 * 4096"
:accept="allowedFileTypes"
multiple
multiple="enableMultipleFileUpload"
:drop="true"
:drop-directory="false"
:data="{
Expand Down
Binary file removed vendor/db/sentiment-analysis.onnx
Binary file not shown.

0 comments on commit 38ba798

Please sign in to comment.