Change sender_id to contact_id in conversations (#167)

* change sender_id to contact_id in conversations

* Fix failing tests

* Fix seeds

* fix specs

* Fix issues in facebook messenger
This commit is contained in:
Sojan Jose
2019-10-21 00:40:18 +05:30
committed by GitHub
parent 2099dc01a6
commit ba8f055802
20 changed files with 294 additions and 309 deletions

View File

@@ -0,0 +1,5 @@
class RenameSenderIdToContactInConversation < ActiveRecord::Migration[6.1]
def change
rename_column :conversations, :sender_id, :contact_id
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_10_20_085608) do
ActiveRecord::Schema.define(version: 2019_10_20_173522) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -85,7 +85,7 @@ ActiveRecord::Schema.define(version: 2019_10_20_085608) do
t.integer "assignee_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "sender_id"
t.bigint "contact_id"
t.integer "display_id", null: false
t.datetime "user_last_seen_at"
t.datetime "agent_last_seen_at"

View File

@@ -10,5 +10,5 @@ inbox = Inbox.create!(channel: web_widget, account: account, name: 'Acme Support
InboxMember.create!(user: user, inbox: inbox)
contact = Contact.create!(name: 'jane', email: 'jane@example.com', phone_number: '0000', inbox: inbox, account: account)
Conversation.create!(account: account, inbox: inbox, status: :open, assignee_id: 1, sender: contact)
Message.create!(content: 'Hello', account_id: 1, inbox_id: 1, conversation_id: 1, message_type: :incoming)
conversation = Conversation.create!(account: account, inbox: inbox, status: :open, assignee: user, contact: contact)
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)