From 4ea718ef18c2171edf8ed0089fd0d28bdfb78ba1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 25 Oct 2018 01:44:02 +0200 Subject: Migrate all old direct messages to new conversations schema (#9085) --- app/models/account_conversation.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') 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 -- cgit