about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-10-25 01:44:02 +0200
committerGitHub <noreply@github.com>2018-10-25 01:44:02 +0200
commit4ea718ef18c2171edf8ed0089fd0d28bdfb78ba1 (patch)
treefd4fe3bc8ab460bdff6eff1763b79dc87b07aa0c /app/models
parent9b5348240eb78814690691288c655ede7d7f9415 (diff)
Migrate all old direct messages to new conversations schema (#9085)
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account_conversation.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/account_conversation.rb b/app/models/account_conversation.rb
index b7447d805..cc6b39279 100644
--- a/app/models/account_conversation.rb
+++ b/app/models/account_conversation.rb
@@ -58,6 +58,9 @@ class AccountConversation < ApplicationRecord
 
     def add_status(recipient, status)
       conversation = find_or_initialize_by(account: recipient, conversation_id: status.conversation_id, participant_account_ids: participants_from_status(recipient, status))
+
+      return conversation if conversation.status_ids.include?(status.id)
+
       conversation.status_ids << status.id
       conversation.unread = status.account_id != recipient.id
       conversation.save