feat: add audit for web channel
This commit is contained in:
@@ -38,6 +38,13 @@
|
||||
"USER_ACTION": {
|
||||
"SIGN_IN": "%{agentName} signed in",
|
||||
"SIGN_OUT": "%{agentName} signed out"
|
||||
},
|
||||
"CHANNEL": {
|
||||
"WEB_WIDGET": {
|
||||
"ADD": "%{agentName} created a new web channel (#%{id})",
|
||||
"EDIT": "%{agentName} updated a web channel (#%{id})",
|
||||
"DELETE": "%{agentName} deleted a web channel (#%{id})"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,9 @@ export default {
|
||||
'inbox:destroy': `AUDIT_LOGS.INBOX.DELETE`,
|
||||
'user:sign_in': `AUDIT_LOGS.USER_ACTION.SIGN_IN`,
|
||||
'user:sign_out': `AUDIT_LOGS.USER_ACTION.SIGN_OUT`,
|
||||
'channel::webwidget:create': `AUDIT_LOGS.CHANNEL.WEB_WIDGET.ADD`,
|
||||
'channel::webwidget:update': `AUDIT_LOGS.CHANNEL.WEB_WIDGET.EDIT`,
|
||||
'channel::webwidget:destroy': `AUDIT_LOGS.CHANNEL.WEB_WIDGET.DELETE`,
|
||||
};
|
||||
|
||||
return this.$t(translationKeys[logActionKey] || '', translationPayload);
|
||||
|
||||
@@ -39,6 +39,7 @@ class Channel::WebWidget < ApplicationRecord
|
||||
{ selected_feature_flags: [] }].freeze
|
||||
|
||||
before_validation :validate_pre_chat_options
|
||||
belongs_to :account
|
||||
validates :website_url, presence: true
|
||||
validates :widget_color, presence: true
|
||||
|
||||
@@ -105,3 +106,5 @@ class Channel::WebWidget < ApplicationRecord
|
||||
}).perform
|
||||
end
|
||||
end
|
||||
|
||||
Channel::WebWidget.include_mod_with('Audit::Channel::WebWidget')
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
module Enterprise::Audit::Channel::WebWidget
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
audited associated_with: :account
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user