From 4b27fdf4dbfcc3c6d30b57f1f581157da91cac13 Mon Sep 17 00:00:00 2001 From: Liam <43280985+LiamAshdown@users.noreply.github.com> Date: Tue, 25 Jul 2023 04:29:04 +0100 Subject: [PATCH] fix: Increase the out of office message length to 10_000 (#7583) --- .../settings/inbox/components/WeeklyAvailability.vue | 4 +++- app/models/inbox.rb | 1 + lib/limits.rb | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/WeeklyAvailability.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/WeeklyAvailability.vue index ce65d8b74..ba3192db1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/WeeklyAvailability.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/WeeklyAvailability.vue @@ -183,7 +183,9 @@ export default { await this.$store.dispatch('inboxes/updateInbox', payload); this.showAlert(this.$t('INBOX_MGMT.EDIT.API.SUCCESS_MESSAGE')); } catch (error) { - this.showAlert(this.$t('INBOX_MGMT.EDIT.API.SUCCESS_MESSAGE')); + this.showAlert( + error.message || this.$t('INBOX_MGMT.EDIT.API.ERROR_MESSAGE') + ); } }, }, diff --git a/app/models/inbox.rb b/app/models/inbox.rb index 07ca46cbf..802346f7f 100644 --- a/app/models/inbox.rb +++ b/app/models/inbox.rb @@ -50,6 +50,7 @@ class Inbox < ApplicationRecord message: I18n.t('errors.inboxes.validations.name') } validates :account_id, presence: true validates :timezone, inclusion: { in: TZInfo::Timezone.all_identifiers } + validates :out_of_office_message, length: { maximum: Limits::OUT_OF_OFFICE_MESSAGE_MAX_LENGTH } validate :ensure_valid_max_assignment_limit belongs_to :account diff --git a/lib/limits.rb b/lib/limits.rb index f9b0be7d6..b375d2759 100644 --- a/lib/limits.rb +++ b/lib/limits.rb @@ -2,4 +2,5 @@ module Limits BULK_ACTIONS_LIMIT = 100 BULK_EXTERNAL_HTTP_CALLS_LIMIT = 25 URL_LENGTH_LIMIT = 2048 # https://stackoverflow.com/questions/417142 + OUT_OF_OFFICE_MESSAGE_MAX_LENGTH = 10_000 end