From dcbca173ac7b153a9cc63b738731de2ab7aed23e Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Thu, 23 Jun 2022 20:36:46 +0530 Subject: [PATCH] chore: Revert the migration for inbox name changes (#4919) --- .../dashboard/settings/inbox/Settings.vue | 4 ++-- app/javascript/shared/helpers/Validators.js | 1 - app/models/inbox.rb | 2 +- ...move_special_characters_from_inbox_name.rb | 19 +++++-------------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue index acf6c4d74..f044f0d80 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue @@ -326,7 +326,7 @@ diff --git a/app/javascript/shared/helpers/Validators.js b/app/javascript/shared/helpers/Validators.js index d95dac615..993524fc9 100644 --- a/app/javascript/shared/helpers/Validators.js +++ b/app/javascript/shared/helpers/Validators.js @@ -16,4 +16,3 @@ export const isValidPassword = value => { containsSpecialCharacter ); }; -export const isValidName = value => /^\b[\w\s]*\b$/.test(value); diff --git a/app/models/inbox.rb b/app/models/inbox.rb index 929b327e4..b58e6870a 100644 --- a/app/models/inbox.rb +++ b/app/models/inbox.rb @@ -33,7 +33,7 @@ class Inbox < ApplicationRecord include Avatarable include OutOfOffisable - validates :name, presence: true, format: { with: /^\b[\w\s]*\b$/, multiline: true } + validates :name, presence: true validates :account_id, presence: true validates :timezone, inclusion: { in: TZInfo::Timezone.all_identifiers } validate :ensure_valid_max_assignment_limit diff --git a/db/migrate/20220616154502_remove_special_characters_from_inbox_name.rb b/db/migrate/20220616154502_remove_special_characters_from_inbox_name.rb index 0794250d1..d108bb415 100644 --- a/db/migrate/20220616154502_remove_special_characters_from_inbox_name.rb +++ b/db/migrate/20220616154502_remove_special_characters_from_inbox_name.rb @@ -1,17 +1,8 @@ class RemoveSpecialCharactersFromInboxName < ActiveRecord::Migration[6.1] - def change - remove_special_characters_from_inbox_name - end + # This PR tried to remove special characters from the inbox name + # It broke in the Chatwoot Cloud as there were inboxes with valid special characters + # We had to push a temporary fix to continue the deployment by removing the logic + # from this migration. Keeping this migration here to remove inconsistency. - private - - def remove_special_characters_from_inbox_name - ::Inbox.find_in_batches do |inbox_batch| - Rails.logger.info "Migrated till #{inbox_batch.first.id}\n" - inbox_batch.each do |inbox| - inbox.name = inbox.name.gsub(/[^\w\s_]/, '') - inbox.save! - end - end - end + def change; end end