mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Don't create user first records on private posts
This commit is contained in:
parent
50fbda1ab7
commit
64a1a44c4b
2 changed files with 15 additions and 0 deletions
|
@ -33,6 +33,8 @@ class CookedPostProcessor
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_firsts
|
def create_firsts
|
||||||
|
return unless Guardian.new.can_see?(@post)
|
||||||
|
|
||||||
created = false
|
created = false
|
||||||
|
|
||||||
if @doc.css("img.emoji").size > 0
|
if @doc.css("img.emoji").size > 0
|
||||||
|
|
|
@ -30,4 +30,17 @@ describe UserFirst do
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue