This commit is contained in:
Toks
2013-05-20 08:42:15 -04:00
parent 1fe8b59c7a
commit d99e9c5d81
3 changed files with 16 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ class PoolsController < ApplicationController
raise User::PrivilegeError
end
@pool.update_attribute(:is_deleted, true)
@pool.create_mod_action_for_delete
respond_with(@pool, :notice => "Pool deleted")
end
@@ -61,6 +62,7 @@ class PoolsController < ApplicationController
raise User::PrivilegeError
end
@pool.update_attribute(:is_deleted, false)
@pool.create_mod_action_for_undelete
respond_with(@pool, :notice => "Pool undeleted")
end

View File

@@ -152,8 +152,16 @@ class Pool < ActiveRecord::Base
user.is_janitor?
end
def create_mod_action_for_delete
ModAction.create(:description => "deleted pool ##{id} (name: #{name})")
end
def create_mod_action_for_undelete
ModAction.create(:description => "undeleted pool ##{id} (name: #{name})")
end
def create_mod_action_for_destroy
ModAction.create(:description => "deleted pool ##{id} name=#{name} post_ids=#{post_ids}")
ModAction.create(:description => "permanently deleted pool ##{id} name=#{name} post_ids=#{post_ids}")
end
def add!(post)

View File

@@ -3,6 +3,7 @@ class WikiPage < ActiveRecord::Base
before_validation :initialize_creator, :on => :create
before_validation :initialize_updater
after_save :create_version
before_destroy :create_mod_action_for_destroy
belongs_to :creator, :class_name => "User"
belongs_to :updater, :class_name => "User"
validates_uniqueness_of :title, :case_sensitive => false
@@ -159,4 +160,8 @@ class WikiPage < ActiveRecord::Base
end
end.map {|x| x.mb_chars.downcase.tr(" ", "_").to_s}
end
def create_mod_action_for_destroy
ModAction.create(:description => "permanently deleted wiki page [[#{title}]]")
end
end