mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: an existing member of a channel is allowed to join (#26884)
There's no point checking if a user can join a channel if they are already part of it. This case was frequent when using `enforce_membership: true` for custom bots for example.
This commit is contained in:
@ -227,9 +227,15 @@ RSpec.describe Chat::CreateMessage do
|
||||
|
||||
context "when channel model is found" do
|
||||
context "when user can't join channel" do
|
||||
let(:guardian) { Guardian.new }
|
||||
let(:guardian) { other_user.guardian }
|
||||
|
||||
it { is_expected.to fail_a_policy(:allowed_to_join_channel) }
|
||||
|
||||
context "when the user is already member of the channel" do
|
||||
before { channel.add(guardian.user) }
|
||||
|
||||
it { is_expected.to be_a_success }
|
||||
end
|
||||
end
|
||||
|
||||
context "when user is system" do
|
||||
|
Reference in New Issue
Block a user