FIX: direct message channels can be flagged (#22134)

The events leading to this mistake are unclear but we decided few months ago to make direct messages NOT flaggable and even wrote a spec for this, when we actually support flagging of direct messages.

This commit ensures it will show for direct messages channels and inverses the existing spec.
This commit is contained in:
Joffrey JAFFEUX 2023-06-16 03:04:59 +02:00 committed by GitHub
parent d53e306681
commit 7352ba1fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -122,7 +122,6 @@ export default class ChatMessageInteractor {
get canFlagMessage() {
return (
this.currentUser?.id !== this.message?.user?.id &&
!this.message.channel?.isDirectMessageChannel &&
this.message?.userFlagStatus === undefined &&
this.message.channel?.canFlag &&
!this.message?.chatWebhookEvent &&

View File

@ -34,11 +34,11 @@ RSpec.describe "Flag message", type: :system do
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user]) }
fab!(:message_1) { Fabricate(:chat_message, chat_channel: dm_channel_1) }
it "doesnt allow to flag a message" do
it "allows to flag a message" do
chat.visit_channel(dm_channel_1)
channel.expand_message_actions(message_1)
expect(page).to have_no_css("[data-value='flag']")
expect(page).to have_css("[data-value='flag']")
end
end
end