fixes #1337
This commit is contained in:
@@ -35,14 +35,14 @@ module Moderator
|
|||||||
def ban
|
def ban
|
||||||
@post = ::Post.find(params[:id])
|
@post = ::Post.find(params[:id])
|
||||||
if params[:commit] == "Ban"
|
if params[:commit] == "Ban"
|
||||||
@post.update_column(:is_banned, true)
|
@post.ban!
|
||||||
end
|
end
|
||||||
redirect_to(post_path(@post), :notice => "Post was banned")
|
redirect_to(post_path(@post), :notice => "Post was banned")
|
||||||
end
|
end
|
||||||
|
|
||||||
def unban
|
def unban
|
||||||
@post = ::Post.find(params[:id])
|
@post = ::Post.find(params[:id])
|
||||||
@post.update_attribute(:is_banned, false)
|
@post.unban!
|
||||||
redirect_to(post_path(@post), :notice => "Post was unbanned")
|
redirect_to(post_path(@post), :notice => "Post was unbanned")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -797,6 +797,16 @@ class Post < ActiveRecord::Base
|
|||||||
destroy
|
destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ban!
|
||||||
|
update_column(:is_banned, true)
|
||||||
|
ModAction.create(:description => "banned post ##{id}")
|
||||||
|
end
|
||||||
|
|
||||||
|
def unban!
|
||||||
|
update_column(:is_banned, false)
|
||||||
|
ModAction.create(:description => "unbanned post ##{id}")
|
||||||
|
end
|
||||||
|
|
||||||
def delete!(options = {})
|
def delete!(options = {})
|
||||||
if is_status_locked?
|
if is_status_locked?
|
||||||
self.errors.add(:is_status_locked, "; cannot delete post")
|
self.errors.add(:is_status_locked, "; cannot delete post")
|
||||||
|
|||||||
Reference in New Issue
Block a user