Feature: Inbox greeting message (#927)

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Sojan Jose
2020-06-09 23:54:35 +05:30
committed by GitHub
parent 8b022311c0
commit 432dad203b
48 changed files with 262 additions and 120 deletions

View File

@@ -0,0 +1,21 @@
class AgentAwayMessageToAutoReply < ActiveRecord::Migration[6.0]
def change
add_column :inboxes, :greeting_enabled, :boolean, default: false # rubocop:disable Rails/BulkChangeTable
add_column :inboxes, :greeting_message, :string
migrate_agent_away_to_greeting
remove_column :channel_web_widgets, :agent_away_message, :string
end
def migrate_agent_away_to_greeting
::Channel::WebWidget.find_in_batches do |widget_batch|
widget_batch.each do |widget|
inbox = widget.inbox
inbox.greeting_enabled = true
inbox.greeting_message = widget.agent_away_message
widget.save!
end
end
end
end