FIX: Toggling a post's wiki status should not skip revision.
This commit is contained in:
parent
efc21366ae
commit
781d83a46f
|
@ -394,7 +394,7 @@ class PostsController < ApplicationController
|
|||
post = find_post_from_params
|
||||
guardian.ensure_can_wiki!(post)
|
||||
|
||||
post.revise(current_user, { wiki: params[:wiki] }, { skip_revision: true })
|
||||
post.revise(current_user, { wiki: params[:wiki] })
|
||||
|
||||
render nothing: true
|
||||
end
|
||||
|
|
|
@ -465,18 +465,21 @@ describe PostsController do
|
|||
expect(response).to be_forbidden
|
||||
end
|
||||
|
||||
it "toggle wiki status should not create a new version" do
|
||||
it "toggle wiki status should create a new version" do
|
||||
admin = log_in(:admin)
|
||||
another_user = Fabricate(:user)
|
||||
another_post = Fabricate(:post, user: another_user)
|
||||
|
||||
expect { xhr :put, :wiki, post_id: another_post.id, wiki: 'true' }
|
||||
.to_not change { another_post.reload.version }
|
||||
.to change { another_post.reload.version }.by(1)
|
||||
|
||||
expect { xhr :put, :wiki, post_id: another_post.id, wiki: 'false' }
|
||||
.to change { another_post.reload.version }.by(-1)
|
||||
|
||||
another_admin = log_in(:admin)
|
||||
|
||||
expect { xhr :put, :wiki, post_id: another_post.id, wiki: 'false' }
|
||||
.to_not change { another_post.reload.version }
|
||||
expect { xhr :put, :wiki, post_id: another_post.id, wiki: 'true' }
|
||||
.to change { another_post.reload.version }.by(1)
|
||||
end
|
||||
|
||||
it "can wiki a post" do
|
||||
|
|
Loading…
Reference in New Issue