From 0f2d3418f91c774fe33f8ccca91f915ba18462af Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Sat, 25 Jul 2020 22:54:45 +0530 Subject: [PATCH] fix: Add a check for 24 hour window before sending a message (#1084) Co-authored-by: Sojan Jose --- .scss-lint.yml | 1 + app/javascript/dashboard/api/inbox/message.js | 3 +- .../dashboard/assets/scss/_variables.scss | 2 +- app/javascript/dashboard/assets/scss/app.scss | 4 +- .../widgets/conversation/MessagesView.vue | 28 ++++++++ .../widgets/conversation/ReplyBox.vue | 24 +++++-- .../i18n/locale/en/conversation.json | 2 + .../store/modules/conversations/actions.js | 7 ++ .../store/modules/conversations/index.js | 10 +++ .../specs/conversations/actions.spec.js | 26 +++++++ .../specs/conversations/mutations.spec.js | 11 +++ .../dashboard/store/mutation-types.js | 4 +- .../shared/assets/stylesheets/colors.scss | 69 +++++++++++++++++++ .../shared/assets/stylesheets/font-size.scss | 13 ++++ .../shared/assets/stylesheets/spacing.scss | 16 +++++ app/models/channel/api.rb | 4 ++ app/models/channel/email.rb | 4 ++ app/models/channel/facebook_page.rb | 4 ++ app/models/channel/twilio_sms.rb | 4 ++ app/models/channel/twitter_profile.rb | 4 ++ app/models/channel/web_widget.rb | 4 ++ app/models/conversation.rb | 10 +++ .../conversations/event_data_presenter.rb | 3 +- .../partials/_conversation.json.jbuilder | 1 + spec/models/conversation_spec.rb | 42 +++++++++++ .../event_data_presenter_spec.rb | 1 + 26 files changed, 292 insertions(+), 9 deletions(-) create mode 100644 app/javascript/shared/assets/stylesheets/colors.scss create mode 100644 app/javascript/shared/assets/stylesheets/font-size.scss create mode 100644 app/javascript/shared/assets/stylesheets/spacing.scss diff --git a/.scss-lint.yml b/.scss-lint.yml index 19fae0cf1..1cc029441 100644 --- a/.scss-lint.yml +++ b/.scss-lint.yml @@ -282,3 +282,4 @@ exclude: - 'app/javascript/widget/assets/scss/_reset.scss' - 'app/javascript/widget/assets/scss/sdk.css' - 'app/assets/stylesheets/administrate/reset/_normalize.scss' + - 'app/javascript/shared/assets/stylesheets/*.scss' diff --git a/app/javascript/dashboard/api/inbox/message.js b/app/javascript/dashboard/api/inbox/message.js index c9681f685..465095f44 100644 --- a/app/javascript/dashboard/api/inbox/message.js +++ b/app/javascript/dashboard/api/inbox/message.js @@ -20,9 +20,10 @@ class MessageApi extends ApiClient { }); } - sendAttachment([conversationId, { file }]) { + sendAttachment([conversationId, { file, isPrivate = false }]) { const formData = new FormData(); formData.append('attachments[]', file, file.name); + formData.append('private', isPrivate); return axios({ method: 'post', url: `${this.url}/${conversationId}/messages`, diff --git a/app/javascript/dashboard/assets/scss/_variables.scss b/app/javascript/dashboard/assets/scss/_variables.scss index 1798d918b..c3cbe0c18 100644 --- a/app/javascript/dashboard/assets/scss/_variables.scss +++ b/app/javascript/dashboard/assets/scss/_variables.scss @@ -46,8 +46,8 @@ $color-gray: #6e6f73; $color-light-gray: #999a9b; $color-border: #e0e6ed; $color-border-light: #f0f4f5; -$color-background: #f4f6fb; $color-border-dark: #cad0d4; +$color-background: #f4f6fb; $color-background-light: #f9fafc; $color-white: #fff; $color-body: #3c4858; diff --git a/app/javascript/dashboard/assets/scss/app.scss b/app/javascript/dashboard/assets/scss/app.scss index 3a6f62972..3d01856ef 100644 --- a/app/javascript/dashboard/assets/scss/app.scss +++ b/app/javascript/dashboard/assets/scss/app.scss @@ -1,5 +1,7 @@ @import 'shared/assets/fonts/inter'; - +@import 'shared/assets/stylesheets/colors'; +@import 'shared/assets/stylesheets/spacing'; +@import 'shared/assets/stylesheets/font-size'; @import 'variables'; @import '~spinkit/scss/spinners/7-three-bounce'; diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue index 7a67b4e46..e0805c08c 100644 --- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue +++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue @@ -5,6 +5,18 @@ :is-contact-panel-open="isContactPanelOpen" @contactPanelToggle="onToggleContactPanel" /> +
+ + {{ $t('CONVERSATION.CANNOT_REPLY') }} + + {{ $t('CONVERSATION.24_HOURS_WINDOW') }} + + +