mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
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:

committed by
Loïc Guitaut

parent
7e992cb299
commit
abcaa1a961
@ -27,8 +27,14 @@ describe Chat::ChatMessageCreator do
|
||||
fab!(:public_chat_channel) { Fabricate(:category_channel) }
|
||||
fab!(:dm_chat_channel) do
|
||||
Fabricate(
|
||||
:dm_channel,
|
||||
chatable: Fabricate(:direct_message_channel, users: [user1, user2, user3]),
|
||||
:direct_message_channel,
|
||||
chatable: Fabricate(:direct_message, users: [user1, user2, user3]),
|
||||
)
|
||||
end
|
||||
let(:direct_message_channel) do
|
||||
Chat::DirectMessageChannelCreator.create!(
|
||||
acting_user: user1,
|
||||
target_users: [user1, user2],
|
||||
)
|
||||
end
|
||||
|
||||
@ -43,8 +49,7 @@ describe Chat::ChatMessageCreator do
|
||||
end
|
||||
|
||||
Group.refresh_automatic_groups!
|
||||
@direct_message_channel =
|
||||
Chat::DirectMessageChannelCreator.create!(acting_user: user1, target_users: [user1, user2])
|
||||
direct_message_channel
|
||||
end
|
||||
|
||||
describe "Integration tests with jobs running immediately" do
|
||||
@ -210,7 +215,7 @@ describe Chat::ChatMessageCreator do
|
||||
it "creates only mention notifications for users with access in private chat" do
|
||||
expect {
|
||||
Chat::ChatMessageCreator.create(
|
||||
chat_channel: @direct_message_channel,
|
||||
chat_channel: direct_message_channel,
|
||||
user: user1,
|
||||
content: "hello there @#{user2.username} and @#{user3.username}",
|
||||
)
|
||||
@ -221,7 +226,7 @@ describe Chat::ChatMessageCreator do
|
||||
it "creates a mention notifications for group users that are participating in private chat" do
|
||||
expect {
|
||||
Chat::ChatMessageCreator.create(
|
||||
chat_channel: @direct_message_channel,
|
||||
chat_channel: direct_message_channel,
|
||||
user: user1,
|
||||
content: "hello there @#{user_group.name}",
|
||||
)
|
||||
@ -261,7 +266,7 @@ describe Chat::ChatMessageCreator do
|
||||
user2.update(suspended_till: Time.now + 10.years)
|
||||
expect {
|
||||
Chat::ChatMessageCreator.create(
|
||||
chat_channel: @direct_message_channel,
|
||||
chat_channel: direct_message_channel,
|
||||
user: user1,
|
||||
content: "hello @#{user2.username}",
|
||||
)
|
||||
|
Reference in New Issue
Block a user