DEV: Rename direct message related models

This is a followup of the previous refactor where we created two new
models to handle all the dedicated logic that was present in the
`ChatChannel` model.

For the sake of consistency, `DMChannel` has been renamed to
`DirectMessageChannel` and the previous `DirectMessageChannel` model is
now named `DirectMessage`. This should help reasoning about direct
messages.
This commit is contained in:
Loïc Guitaut
2022-11-02 15:53:36 +01:00
committed by Loïc Guitaut
parent 7e992cb299
commit abcaa1a961
57 changed files with 378 additions and 455 deletions

View File

@ -7,12 +7,10 @@ RSpec.shared_examples "a chat channel model" do
fab!(:group) { Fabricate(:group) }
fab!(:private_category) { Fabricate(:private_category, group: group) }
fab!(:private_category_channel) { Fabricate(:category_channel, chatable: private_category) }
fab!(:direct_message_channel) do
Fabricate(:dm_channel, chatable: Fabricate(:direct_message_channel, users: [user1, user2]))
end
fab!(:direct_message_channel) { Fabricate(:direct_message_channel, users: [user1, user2]) }
it { is_expected.to belong_to(:chatable) }
it { is_expected.to belong_to(:direct_message_channel).with_foreign_key(:chatable_id) }
it { is_expected.to belong_to(:direct_message).with_foreign_key(:chatable_id) }
it { is_expected.to have_many(:chat_messages) }
it { is_expected.to have_many(:user_chat_channel_memberships) }
it { is_expected.to have_one(:chat_channel_archive) }