FIX: stop 'tag_added' rules from firing for normal posts (#165)
This commit is contained in:
parent
9332d77483
commit
9647c7afc0
|
@ -80,6 +80,8 @@ module DiscourseChatIntegration
|
||||||
# by tag later
|
# by tag later
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
matching_rules = matching_rules.select { |rule| rule.filter != "tag_added" }
|
||||||
end
|
end
|
||||||
|
|
||||||
# If tagging is enabled, thow away rules that don't apply to this topic
|
# If tagging is enabled, thow away rules that don't apply to this topic
|
||||||
|
|
|
@ -417,6 +417,19 @@ RSpec.describe DiscourseChatIntegration::Manager do
|
||||||
expect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)
|
expect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't notify when a new regular post is created" do
|
||||||
|
DiscourseChatIntegration::Rule.create!(
|
||||||
|
channel: chan1,
|
||||||
|
filter: "tag_added",
|
||||||
|
category_id: nil,
|
||||||
|
tags: [tag.name],
|
||||||
|
)
|
||||||
|
|
||||||
|
post = Fabricate(:post, topic: tagged_topic)
|
||||||
|
manager.trigger_notifications(post.id)
|
||||||
|
expect(provider.sent_to_channel_ids).to contain_exactly
|
||||||
|
end
|
||||||
|
|
||||||
it "doesn't notify when topic has an unchanged tag present in the rule, even if a new tag is added" do
|
it "doesn't notify when topic has an unchanged tag present in the rule, even if a new tag is added" do
|
||||||
post = set_new_tags_and_return_small_action_post([tag.name, additional_tag.name])
|
post = set_new_tags_and_return_small_action_post([tag.name, additional_tag.name])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue