Revert "FIX: supports groups field in post_created_edited (#28773)" (#28781)

This reverts commit eb3a1c72179c179af358daf41b167e337cc7b454.
This commit is contained in:
Joffrey JAFFEUX
2024-09-06 16:10:53 +02:00
committed by GitHub
parent eb3a1c7217
commit 5f5680dbaf
9 changed files with 22 additions and 201 deletions

View File

@ -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