mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: replace PM tags dropdown with a dedicated tags page
This commit is contained in:
@@ -98,9 +98,8 @@ describe Tag do
|
||||
|
||||
describe '#pm_tags' do
|
||||
before do
|
||||
@private_tags = []
|
||||
personal_message = Fabricate(:private_message_topic)
|
||||
2.times { |i| @private_tags << Fabricate(:tag, topics: [personal_message]) }
|
||||
2.times { |i| Fabricate(:tag, topics: [personal_message], name: "tag-#{i}") }
|
||||
end
|
||||
|
||||
it "returns nothing if user is not a staff" do
|
||||
@@ -114,7 +113,10 @@ describe Tag do
|
||||
|
||||
it "returns all pm tags if user is a staff and pm tagging is enabled" do
|
||||
SiteSetting.allow_staff_to_tag_pms = true
|
||||
expect(described_class.pm_tags(guardian: Guardian.new(Fabricate(:admin)))).to match_array(@private_tags.map(&:name))
|
||||
tags = described_class.pm_tags(guardian: Guardian.new(Fabricate(:admin)))
|
||||
expect(tags.length).to eq(2)
|
||||
expect(tags[0][:id]).to eq("tag-0")
|
||||
expect(tags[1][:text]).to eq("tag-1")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -78,28 +78,4 @@ describe TopicList do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#pm_tags' do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:personal_message) { Fabricate(:private_message_topic) }
|
||||
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
SiteSetting.allow_staff_to_tag_pms = true
|
||||
@private_tags = []
|
||||
2.times { |i| @private_tags << Fabricate(:tag, topics: [personal_message]) }
|
||||
end
|
||||
|
||||
context 'when viewed as normal user' do
|
||||
it 'returns no tags' do
|
||||
expect(TopicList.new('liked', personal_message.user, [personal_message], show_pm_tags: true).pm_tags).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'when viewed as admin' do
|
||||
it 'returns pm tags' do
|
||||
expect(TopicList.new('liked', admin, [personal_message], show_pm_tags: true).pm_tags).to match_array(@private_tags.map(&:name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user