mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FEATURE: Hide summarization in PMs (#26532)
This commit is contained in:
parent
552203aa1d
commit
dd83a07550
@ -24,6 +24,7 @@ module Summarization
|
||||
|
||||
def can_see_summary?(target, user)
|
||||
return false if SiteSetting.summarization_strategy.blank?
|
||||
return false if target.class == Topic && target.private_message?
|
||||
|
||||
has_cached_summary = SummarySection.exists?(target: target, meta_section_id: nil)
|
||||
return has_cached_summary if user.nil?
|
||||
|
@ -65,5 +65,14 @@ describe Summarization::Base do
|
||||
expect(described_class.can_see_summary?(topic, nil)).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context "when the topic is a PM" do
|
||||
before { SiteSetting.custom_summarization_allowed_groups = group.id }
|
||||
let(:pm) { Fabricate(:private_message_topic) }
|
||||
|
||||
it "returns false" do
|
||||
expect(described_class.can_see_summary?(pm, user)).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user