parent
f2dd88223f
commit
d5ddc9d76c
6 changed files with 32 additions and 4 deletions
|
@ -30,7 +30,8 @@
|
|||
"ADD": {
|
||||
"CHANNEL_NAME": {
|
||||
"LABEL": "Inbox Name",
|
||||
"PLACEHOLDER": "Enter your inbox name (eg: Acme Inc)"
|
||||
"PLACEHOLDER": "Enter your inbox name (eg: Acme Inc)",
|
||||
"ERROR": "Please enter a valid inbox name"
|
||||
},
|
||||
"WEBSITE_NAME": {
|
||||
"LABEL": "Website Name",
|
||||
|
|
|
@ -30,8 +30,15 @@
|
|||
<woot-input
|
||||
v-model.trim="selectedInboxName"
|
||||
class="medium-9 columns settings-item"
|
||||
:class="{ error: $v.selectedInboxName.$error }"
|
||||
:label="inboxNameLabel"
|
||||
:placeholder="inboxNamePlaceHolder"
|
||||
:error="
|
||||
$v.selectedInboxName.$error
|
||||
? $t('INBOX_MGMT.ADD.CHANNEL_NAME.ERROR')
|
||||
: ''
|
||||
"
|
||||
@blur="$v.selectedInboxName.$touch"
|
||||
/>
|
||||
<label
|
||||
v-if="isATwitterInbox"
|
||||
|
@ -293,6 +300,7 @@
|
|||
<woot-submit-button
|
||||
v-else
|
||||
type="submit"
|
||||
:disabled="$v.$invalid"
|
||||
:button-text="$t('INBOX_MGMT.SETTINGS_POPUP.UPDATE')"
|
||||
:loading="uiFlags.isUpdatingInbox"
|
||||
@click="updateInbox"
|
||||
|
@ -318,7 +326,7 @@
|
|||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { shouldBeUrl } from 'shared/helpers/Validators';
|
||||
import { shouldBeUrl, isValidName } from 'shared/helpers/Validators';
|
||||
import configMixin from 'shared/mixins/configMixin';
|
||||
import alertMixin from 'shared/mixins/alertMixin';
|
||||
import SettingIntroBanner from 'dashboard/components/widgets/SettingIntroBanner';
|
||||
|
@ -563,6 +571,7 @@ export default {
|
|||
webhookUrl: {
|
||||
shouldBeUrl,
|
||||
},
|
||||
selectedInboxName: { isValidName },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -16,3 +16,4 @@ export const isValidPassword = value => {
|
|||
containsSpecialCharacter
|
||||
);
|
||||
};
|
||||
export const isValidName = value => /^\b[\w\s]*\b$/.test(value);
|
||||
|
|
|
@ -33,7 +33,7 @@ class Inbox < ApplicationRecord
|
|||
include Avatarable
|
||||
include OutOfOffisable
|
||||
|
||||
validates :name, presence: true
|
||||
validates :name, presence: true, format: { with: /^\b[\w\s]*\b$/, multiline: true }
|
||||
validates :account_id, presence: true
|
||||
validates :timezone, inclusion: { in: TZInfo::Timezone.all_identifiers }
|
||||
validate :ensure_valid_max_assignment_limit
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class RemoveSpecialCharactersFromInboxName < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
remove_special_characters_from_inbox_name
|
||||
end
|
||||
|
||||
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
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_06_10_091206) do
|
||||
ActiveRecord::Schema.define(version: 2022_06_16_154502) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
|
|
Loading…
Reference in a new issue