fixes #1561
This commit is contained in:
@@ -52,6 +52,7 @@ class PoolsController < ApplicationController
|
|||||||
raise User::PrivilegeError
|
raise User::PrivilegeError
|
||||||
end
|
end
|
||||||
@pool.update_attribute(:is_deleted, true)
|
@pool.update_attribute(:is_deleted, true)
|
||||||
|
@pool.create_mod_action_for_delete
|
||||||
respond_with(@pool, :notice => "Pool deleted")
|
respond_with(@pool, :notice => "Pool deleted")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ class PoolsController < ApplicationController
|
|||||||
raise User::PrivilegeError
|
raise User::PrivilegeError
|
||||||
end
|
end
|
||||||
@pool.update_attribute(:is_deleted, false)
|
@pool.update_attribute(:is_deleted, false)
|
||||||
|
@pool.create_mod_action_for_undelete
|
||||||
respond_with(@pool, :notice => "Pool undeleted")
|
respond_with(@pool, :notice => "Pool undeleted")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -152,8 +152,16 @@ class Pool < ActiveRecord::Base
|
|||||||
user.is_janitor?
|
user.is_janitor?
|
||||||
end
|
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
|
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
|
end
|
||||||
|
|
||||||
def add!(post)
|
def add!(post)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class WikiPage < ActiveRecord::Base
|
|||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
after_save :create_version
|
after_save :create_version
|
||||||
|
before_destroy :create_mod_action_for_destroy
|
||||||
belongs_to :creator, :class_name => "User"
|
belongs_to :creator, :class_name => "User"
|
||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
validates_uniqueness_of :title, :case_sensitive => false
|
validates_uniqueness_of :title, :case_sensitive => false
|
||||||
@@ -159,4 +160,8 @@ class WikiPage < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end.map {|x| x.mb_chars.downcase.tr(" ", "_").to_s}
|
end.map {|x| x.mb_chars.downcase.tr(" ", "_").to_s}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_mod_action_for_destroy
|
||||||
|
ModAction.create(:description => "permanently deleted wiki page [[#{title}]]")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user