mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
FIX: Don't create user first records on private posts
This commit is contained in:
parent
50fbda1ab7
commit
64a1a44c4b
|
@ -33,6 +33,8 @@ class CookedPostProcessor
|
|||
end
|
||||
|
||||
def create_firsts
|
||||
return unless Guardian.new.can_see?(@post)
|
||||
|
||||
created = false
|
||||
|
||||
if @doc.css("img.emoji").size > 0
|
||||
|
|
|
@ -30,4 +30,17 @@ describe UserFirst do
|
|||
end
|
||||
end
|
||||
|
||||
context "privacy" do
|
||||
let(:codinghorror) { Fabricate(:codinghorror) }
|
||||
|
||||
it "doesn't create the userfirst on private posts" do
|
||||
post = PostCreator.create(user,
|
||||
target_usernames: ['codinghorror'],
|
||||
title: "this topic is about candy",
|
||||
raw: "time to eat some sweet :candy: mmmm")
|
||||
|
||||
uf = UserFirst.where(user_id: user.id, first_type: UserFirst.types[:used_emoji]).first
|
||||
expect(uf).to be_blank
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user