Merge pull request #4538 from kgish/master

A new guard for changing post timestamps
This commit is contained in:
Sam 2016-11-07 11:28:47 +11:00 committed by GitHub
commit 6a720b6011
2 changed files with 5 additions and 1 deletions

View File

@ -492,7 +492,7 @@ class TopicsController < ApplicationController
params.require(:topic_id) params.require(:topic_id)
params.require(:timestamp) params.require(:timestamp)
guardian.ensure_can_change_post_owner! guardian.ensure_can_change_post_timestamps!
begin begin
PostTimestampChanger.new( topic_id: params[:topic_id].to_i, PostTimestampChanger.new( topic_id: params[:topic_id].to_i,

View File

@ -185,6 +185,10 @@ module PostGuardian
is_admin? is_admin?
end end
def can_change_post_timestamps?
is_admin?
end
def can_wiki?(post) def can_wiki?(post)
return false unless authenticated? return false unless authenticated?
return true if is_staff? || @user.has_trust_level?(TrustLevel[4]) return true if is_staff? || @user.has_trust_level?(TrustLevel[4])