mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 07:11:17 +08:00
FIX: Recovering a deleted post was not updating a topic's statistics
This commit is contained in:
@ -121,6 +121,8 @@ class PostsController < ApplicationController
|
|||||||
post = find_post_from_params
|
post = find_post_from_params
|
||||||
guardian.ensure_can_recover_post!(post)
|
guardian.ensure_can_recover_post!(post)
|
||||||
post.recover!
|
post.recover!
|
||||||
|
post.topic.update_statistics
|
||||||
|
|
||||||
render nothing: true
|
render nothing: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -123,8 +123,9 @@ describe PostsController do
|
|||||||
response.should be_forbidden
|
response.should be_forbidden
|
||||||
end
|
end
|
||||||
|
|
||||||
it "calls recover" do
|
it "calls recover and updates the topic's statistics" do
|
||||||
Post.any_instance.expects(:recover!)
|
Post.any_instance.expects(:recover!)
|
||||||
|
Topic.any_instance.expects(:update_statistics)
|
||||||
xhr :put, :recover, post_id: post.id
|
xhr :put, :recover, post_id: post.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user