mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
This reverts commit eb3a1c72179c179af358daf41b167e337cc7b454.
This commit is contained in:
@ -164,50 +164,30 @@ describe "PostCreatedEdited" do
|
||||
|
||||
context "when group is restricted" do
|
||||
fab!(:target_group) { Fabricate(:group, messageable_level: Group::ALIAS_LEVELS[:everyone]) }
|
||||
fab!(:another_group) { Fabricate(:group, messageable_level: Group::ALIAS_LEVELS[:everyone]) }
|
||||
|
||||
before do
|
||||
automation.upsert_field!(
|
||||
"restricted_groups",
|
||||
"groups",
|
||||
{ value: [target_group.id, another_group.id] },
|
||||
"restricted_group",
|
||||
"group",
|
||||
{ value: target_group.id },
|
||||
target: "trigger",
|
||||
)
|
||||
end
|
||||
|
||||
context "when PM is not sent to the group" do
|
||||
it "doesnt fire the trigger" do
|
||||
list =
|
||||
capture_contexts do
|
||||
PostCreator.create(
|
||||
user,
|
||||
basic_topic_params.merge(
|
||||
target_group_names: [Fabricate(:group).name],
|
||||
archetype: Archetype.private_message,
|
||||
),
|
||||
)
|
||||
end
|
||||
it "fires the trigger" do
|
||||
list =
|
||||
capture_contexts do
|
||||
PostCreator.create(
|
||||
user,
|
||||
basic_topic_params.merge(
|
||||
target_group_names: [target_group.name],
|
||||
archetype: Archetype.private_message,
|
||||
),
|
||||
)
|
||||
end
|
||||
|
||||
expect(list.length).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
context "when PM is sent to the group" do
|
||||
it "fires the trigger" do
|
||||
list =
|
||||
capture_contexts do
|
||||
PostCreator.create(
|
||||
user,
|
||||
basic_topic_params.merge(
|
||||
target_group_names: [target_group.name],
|
||||
archetype: Archetype.private_message,
|
||||
),
|
||||
)
|
||||
end
|
||||
|
||||
expect(list.length).to eq(1)
|
||||
expect(list[0]["kind"]).to eq("post_created_edited")
|
||||
end
|
||||
expect(list.length).to eq(1)
|
||||
expect(list[0]["kind"]).to eq("post_created_edited")
|
||||
end
|
||||
|
||||
context "when the topic is not a PM" do
|
||||
|
Reference in New Issue
Block a user