mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:49:06 +08:00
FIX: PostActionCreator
was not checking the guardian properly
It also exposed a bug in the EmailReceiver spec, where a test had a user liking their own post and was not failing.
This commit is contained in:
parent
ec7f418a22
commit
720e896e17
|
@ -7,7 +7,7 @@ class PostActionCreator
|
|||
end
|
||||
|
||||
def perform(action)
|
||||
guardian.ensure_post_can_act!(@post, action, opts: {
|
||||
guardian.ensure_post_can_act!(@post, PostActionType.types[action], opts: {
|
||||
taken_actions: PostAction.counts_for([@post].compact, @user)[@post&.id]
|
||||
})
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ describe Email::Receiver do
|
|||
let(:category) { Fabricate(:category) }
|
||||
let(:user) { Fabricate(:user, email: "discourse@bar.com") }
|
||||
let(:topic) { create_topic(category: category, user: user) }
|
||||
let(:post) { create_post(topic: topic, user: user) }
|
||||
let(:post) { create_post(topic: topic) }
|
||||
|
||||
let!(:post_reply_key) do
|
||||
Fabricate(:post_reply_key,
|
||||
|
|
Loading…
Reference in New Issue
Block a user