fixes
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -14,7 +14,7 @@ group :assets do
|
|||||||
gem "therubyracer"
|
gem "therubyracer"
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "rails", "3.2.1"
|
gem "rails", "3.2.2"
|
||||||
gem "pg"
|
gem "pg"
|
||||||
gem "memcache-client", :require => "memcache"
|
gem "memcache-client", :require => "memcache"
|
||||||
gem "delayed_job"
|
gem "delayed_job"
|
||||||
|
|||||||
102
Gemfile.lock
102
Gemfile.lock
@@ -29,19 +29,19 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: http://github.com/EmmanuelOga/ffaker.git
|
remote: http://github.com/EmmanuelOga/ffaker.git
|
||||||
revision: 0a281092f4ed985b7f7ae6eb2d03677fbcfc722d
|
revision: a2bff9d77503a9cf61eb274725b12e5683b2826c
|
||||||
specs:
|
specs:
|
||||||
ffaker (1.12.1)
|
ffaker (1.13.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://gemcutter.org/
|
remote: http://gemcutter.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.1)
|
actionmailer (3.2.2)
|
||||||
actionpack (= 3.2.1)
|
actionpack (= 3.2.2)
|
||||||
mail (~> 2.4.0)
|
mail (~> 2.4.0)
|
||||||
actionpack (3.2.1)
|
actionpack (3.2.2)
|
||||||
activemodel (= 3.2.1)
|
activemodel (= 3.2.2)
|
||||||
activesupport (= 3.2.1)
|
activesupport (= 3.2.2)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.1)
|
journey (~> 1.0.1)
|
||||||
@@ -49,21 +49,21 @@ GEM
|
|||||||
rack-cache (~> 1.1)
|
rack-cache (~> 1.1)
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.1.2)
|
sprockets (~> 2.1.2)
|
||||||
activemodel (3.2.1)
|
activemodel (3.2.2)
|
||||||
activesupport (= 3.2.1)
|
activesupport (= 3.2.2)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
activerecord (3.2.1)
|
activerecord (3.2.2)
|
||||||
activemodel (= 3.2.1)
|
activemodel (= 3.2.2)
|
||||||
activesupport (= 3.2.1)
|
activesupport (= 3.2.2)
|
||||||
arel (~> 3.0.0)
|
arel (~> 3.0.2)
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.2.1)
|
activeresource (3.2.2)
|
||||||
activemodel (= 3.2.1)
|
activemodel (= 3.2.2)
|
||||||
activesupport (= 3.2.1)
|
activesupport (= 3.2.2)
|
||||||
activesupport (3.2.1)
|
activesupport (3.2.2)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
arel (3.0.0)
|
arel (3.0.2)
|
||||||
awesome_print (1.0.2)
|
awesome_print (1.0.2)
|
||||||
builder (3.0.0)
|
builder (3.0.0)
|
||||||
chronic (0.6.7)
|
chronic (0.6.7)
|
||||||
@@ -79,54 +79,54 @@ GEM
|
|||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (1.3.0)
|
execjs (1.3.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
factory_girl (2.5.2)
|
factory_girl (2.6.3)
|
||||||
activesupport (>= 2.3.9)
|
activesupport (>= 2.3.9)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
i18n (0.6.0)
|
i18n (0.6.0)
|
||||||
journey (1.0.1)
|
journey (1.0.3)
|
||||||
json (1.6.5)
|
json (1.6.5)
|
||||||
libv8 (3.3.10.4)
|
libv8 (3.3.10.4)
|
||||||
mail (2.4.1)
|
mail (2.4.3)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
memcache-client (1.8.5)
|
memcache-client (1.8.5)
|
||||||
metaclass (0.0.1)
|
metaclass (0.0.1)
|
||||||
method_source (0.7.0)
|
method_source (0.7.1)
|
||||||
mime-types (1.17.2)
|
mime-types (1.17.2)
|
||||||
mocha (0.10.4)
|
mocha (0.10.5)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
multi_json (1.0.4)
|
multi_json (1.1.0)
|
||||||
net-http-digest_auth (1.2)
|
net-http-digest_auth (1.2)
|
||||||
net-http-persistent (2.5.1)
|
net-http-persistent (2.5.2)
|
||||||
nokogiri (1.5.0)
|
nokogiri (1.5.2)
|
||||||
ntlm-http (0.1.1)
|
ntlm-http (0.1.1)
|
||||||
pg (0.13.0)
|
pg (0.13.2)
|
||||||
polyamorous (0.5.0)
|
polyamorous (0.5.0)
|
||||||
activerecord (~> 3.0)
|
activerecord (~> 3.0)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
pry (0.9.8.2)
|
pry (0.9.8.4)
|
||||||
coderay (~> 1.0.5)
|
coderay (~> 1.0.5)
|
||||||
method_source (~> 0.7)
|
method_source (~> 0.7.1)
|
||||||
slop (>= 2.4.4, < 3)
|
slop (>= 2.4.4, < 3)
|
||||||
rack (1.4.1)
|
rack (1.4.1)
|
||||||
rack-cache (1.1)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-ssl (1.3.2)
|
rack-ssl (1.3.2)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.1)
|
rack-test (0.6.1)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.1)
|
rails (3.2.2)
|
||||||
actionmailer (= 3.2.1)
|
actionmailer (= 3.2.2)
|
||||||
actionpack (= 3.2.1)
|
actionpack (= 3.2.2)
|
||||||
activerecord (= 3.2.1)
|
activerecord (= 3.2.2)
|
||||||
activeresource (= 3.2.1)
|
activeresource (= 3.2.2)
|
||||||
activesupport (= 3.2.1)
|
activesupport (= 3.2.2)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.1)
|
railties (= 3.2.2)
|
||||||
railties (3.2.1)
|
railties (3.2.2)
|
||||||
actionpack (= 3.2.1)
|
actionpack (= 3.2.2)
|
||||||
activesupport (= 3.2.1)
|
activesupport (= 3.2.2)
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
@@ -140,13 +140,17 @@ GEM
|
|||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
shoulda (2.11.3)
|
shoulda (3.0.1)
|
||||||
|
shoulda-context (~> 1.0.0)
|
||||||
|
shoulda-matchers (~> 1.0.0)
|
||||||
|
shoulda-context (1.0.0)
|
||||||
|
shoulda-matchers (1.0.0)
|
||||||
silent-postgres (0.1.1)
|
silent-postgres (0.1.1)
|
||||||
simple_form (1.5.2)
|
simple_form (2.0.1)
|
||||||
actionpack (~> 3.0)
|
actionpack (~> 3.0)
|
||||||
activemodel (~> 3.0)
|
activemodel (~> 3.0)
|
||||||
simplecov (0.5.4)
|
simplecov (0.6.1)
|
||||||
multi_json (~> 1.0.3)
|
multi_json (~> 1.0)
|
||||||
simplecov-html (~> 0.5.3)
|
simplecov-html (~> 0.5.3)
|
||||||
simplecov-html (0.5.3)
|
simplecov-html (0.5.3)
|
||||||
slop (2.4.4)
|
slop (2.4.4)
|
||||||
@@ -157,22 +161,22 @@ GEM
|
|||||||
super_exception_notifier (3.0.13)
|
super_exception_notifier (3.0.13)
|
||||||
actionmailer
|
actionmailer
|
||||||
rake
|
rake
|
||||||
therubyracer (0.9.9)
|
therubyracer (0.9.10)
|
||||||
libv8 (~> 3.3.10)
|
libv8 (~> 3.3.10)
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
tilt (1.3.3)
|
tilt (1.3.3)
|
||||||
treetop (1.4.10)
|
treetop (1.4.10)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.31)
|
tzinfo (0.3.32)
|
||||||
uglifier (1.2.3)
|
uglifier (1.2.3)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (>= 1.0.2)
|
multi_json (>= 1.0.2)
|
||||||
unf (0.0.4)
|
unf (0.0.5)
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.4)
|
unf_ext (0.0.4)
|
||||||
webrobots (0.0.13)
|
webrobots (0.0.13)
|
||||||
whenever (0.7.2)
|
whenever (0.7.3)
|
||||||
activesupport (>= 2.3.4)
|
activesupport (>= 2.3.4)
|
||||||
chronic (~> 0.6.3)
|
chronic (~> 0.6.3)
|
||||||
|
|
||||||
@@ -193,7 +197,7 @@ DEPENDENCIES
|
|||||||
nokogiri
|
nokogiri
|
||||||
pg
|
pg
|
||||||
pry
|
pry
|
||||||
rails (= 3.2.1)
|
rails (= 3.2.2)
|
||||||
rmagick
|
rmagick
|
||||||
sanitize!
|
sanitize!
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ForumPostsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = ForumPost.search(params[:search])
|
@search = ForumPost.active.search(params[:search])
|
||||||
@forum_posts = @search.paginate(params[:page]).order("forum_posts.id desc")
|
@forum_posts = @search.paginate(params[:page]).order("forum_posts.id desc")
|
||||||
respond_with(@forum_posts)
|
respond_with(@forum_posts)
|
||||||
end
|
end
|
||||||
@@ -44,7 +44,14 @@ class ForumPostsController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@forum_post = ForumPost.find(params[:id])
|
@forum_post = ForumPost.find(params[:id])
|
||||||
check_privilege(@forum_post)
|
check_privilege(@forum_post)
|
||||||
@forum_post.destroy
|
@forum_post.update_attribute(:is_deleted, true)
|
||||||
|
respond_with(@forum_post)
|
||||||
|
end
|
||||||
|
|
||||||
|
def undelete
|
||||||
|
@forum_post = ForumPost.find(params[:id])
|
||||||
|
check_privilege(@forum_post)
|
||||||
|
@forum_post.update_attribute(:is_deleted, false)
|
||||||
respond_with(@forum_post)
|
respond_with(@forum_post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class ForumTopicsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = ForumTopic.search(params[:search])
|
@search = ForumTopic.active.search(params[:search])
|
||||||
@forum_topics = @search.paginate(params[:page]).order("is_sticky DESC, updated_at DESC")
|
@forum_topics = @search.paginate(params[:page]).order("is_sticky DESC, updated_at DESC")
|
||||||
respond_with(@forum_topics)
|
respond_with(@forum_topics)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PoolsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Pool.search(params[:search])
|
@search = Pool.active.search(params[:search])
|
||||||
@pools = @search.paginate(params[:page])
|
@pools = @search.paginate(params[:page])
|
||||||
respond_with(@pools)
|
respond_with(@pools)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
class ForumPost < ActiveRecord::Base
|
class ForumPost < ActiveRecord::Base
|
||||||
attr_accessible :body, :topic_id, :as => [:member, :privileged, :contributor, :janitor, :admin, :moderator, :default]
|
attr_accessible :body, :topic_id, :as => [:member, :privileged, :contributor, :janitor, :admin, :moderator, :default]
|
||||||
attr_accessible :is_locked, :is_sticky, :as => [:admin, :moderator]
|
attr_accessible :is_locked, :is_sticky, :is_deleted, :as => [:admin, :moderator]
|
||||||
belongs_to :creator, :class_name => "User"
|
belongs_to :creator, :class_name => "User"
|
||||||
belongs_to :topic, :class_name => "ForumTopic"
|
belongs_to :topic, :class_name => "ForumTopic"
|
||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
|
before_validation :initialize_is_deleted, :on => :create
|
||||||
after_save :update_topic_updated_at
|
after_save :update_topic_updated_at
|
||||||
validates_presence_of :body, :creator_id
|
validates_presence_of :body, :creator_id
|
||||||
validate :validate_topic_is_unlocked
|
validate :validate_topic_is_unlocked
|
||||||
before_destroy :validate_topic_is_unlocked
|
before_destroy :validate_topic_is_unlocked
|
||||||
scope :body_matches, lambda {|body| where(["forum_posts.text_index @@ plainto_tsquery(?)", body])}
|
scope :body_matches, lambda {|body| where(["forum_posts.text_index @@ plainto_tsquery(?)", body])}
|
||||||
scope :for_user, lambda {|user_id| where("forum_posts.creator_id = ?", user_id)}
|
scope :for_user, lambda {|user_id| where("forum_posts.creator_id = ?", user_id)}
|
||||||
|
scope :active, where("is_deleted = false")
|
||||||
search_methods :body_matches
|
search_methods :body_matches
|
||||||
|
|
||||||
def self.new_reply(params)
|
def self.new_reply(params)
|
||||||
@@ -55,6 +57,10 @@ class ForumPost < ActiveRecord::Base
|
|||||||
self.updater_id = CurrentUser.id
|
self.updater_id = CurrentUser.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initialize_is_deleted
|
||||||
|
self.is_deleted = false if is_deleted.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def build_response
|
def build_response
|
||||||
dup.tap do |x|
|
dup.tap do |x|
|
||||||
x.body = "[quote]\n#{x.body}\n[/quote]\n\n"
|
x.body = "[quote]\n#{x.body}\n[/quote]\n\n"
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
class ForumTopic < ActiveRecord::Base
|
class ForumTopic < ActiveRecord::Base
|
||||||
attr_accessible :title, :original_post_attributes, :as => [:member, :privileged, :contributor, :janitor, :moderator, :admin, :default]
|
attr_accessible :title, :original_post_attributes, :as => [:member, :privileged, :contributor, :janitor, :moderator, :admin, :default]
|
||||||
attr_accessible :is_sticky, :is_locked, :as => [:admin, :moderator]
|
attr_accessible :is_sticky, :is_locked, :is_deleted, :as => [:admin, :moderator]
|
||||||
belongs_to :creator, :class_name => "User"
|
belongs_to :creator, :class_name => "User"
|
||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
has_many :posts, :class_name => "ForumPost", :order => "forum_posts.id asc", :foreign_key => "topic_id", :dependent => :destroy
|
has_many :posts, :class_name => "ForumPost", :order => "forum_posts.id asc", :foreign_key => "topic_id", :dependent => :destroy
|
||||||
has_one :original_post, :class_name => "ForumPost", :order => "forum_posts.id asc", :foreign_key => "topic_id"
|
has_one :original_post, :class_name => "ForumPost", :order => "forum_posts.id asc", :foreign_key => "topic_id"
|
||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
|
before_validation :initialize_is_deleted, :on => :create
|
||||||
validates_presence_of :title, :creator_id
|
validates_presence_of :title, :creator_id
|
||||||
validates_associated :original_post
|
validates_associated :original_post
|
||||||
scope :title_matches, lambda {|title| where(["text_index @@ plainto_tsquery(?)", title])}
|
scope :title_matches, lambda {|title| where(["text_index @@ plainto_tsquery(?)", title])}
|
||||||
|
scope :active, where("is_deleted = false")
|
||||||
search_methods :title_matches
|
search_methods :title_matches
|
||||||
accepts_nested_attributes_for :original_post
|
accepts_nested_attributes_for :original_post
|
||||||
|
|
||||||
@@ -17,6 +19,10 @@ class ForumTopic < ActiveRecord::Base
|
|||||||
creator_id == user.id || user.is_moderator?
|
creator_id == user.id || user.is_moderator?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initialize_is_deleted
|
||||||
|
self.is_deleted = false if is_deleted.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def initialize_creator
|
def initialize_creator
|
||||||
self.creator_id = CurrentUser.id
|
self.creator_id = CurrentUser.id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ class Pool < ActiveRecord::Base
|
|||||||
has_many :versions, :class_name => "PoolVersion", :dependent => :destroy, :order => "pool_versions.id ASC"
|
has_many :versions, :class_name => "PoolVersion", :dependent => :destroy, :order => "pool_versions.id ASC"
|
||||||
before_validation :normalize_name
|
before_validation :normalize_name
|
||||||
before_validation :normalize_post_ids
|
before_validation :normalize_post_ids
|
||||||
|
before_validation :initialize_is_active, :on => :create
|
||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
after_save :create_version
|
after_save :create_version
|
||||||
before_destroy :create_mod_action_for_destroy
|
before_destroy :create_mod_action_for_destroy
|
||||||
attr_accessible :name, :description, :post_ids, :post_id_array, :is_active, :post_count
|
attr_accessible :name, :description, :post_ids, :post_id_array, :is_active, :post_count
|
||||||
|
scope :active, where("is_active = true")
|
||||||
|
|
||||||
def self.name_to_id(name)
|
def self.name_to_id(name)
|
||||||
if name =~ /^\d+$/
|
if name =~ /^\d+$/
|
||||||
@@ -52,6 +54,10 @@ class Pool < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initialize_is_active
|
||||||
|
self.is_active = true if is_active.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def initialize_creator
|
def initialize_creator
|
||||||
self.creator_id = CurrentUser.id
|
self.creator_id = CurrentUser.id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ class Post < ActiveRecord::Base
|
|||||||
def pools
|
def pools
|
||||||
@pools ||= begin
|
@pools ||= begin
|
||||||
pool_ids = pool_string.scan(/\d+/)
|
pool_ids = pool_string.scan(/\d+/)
|
||||||
Pool.where(["id in (?)", pool_ids])
|
Pool.where(["is_active = true and id in (?)", pool_ids])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<article data-forum-post-id="<%= forum_post.id %>">
|
<article data-forum-post-id="<%= forum_post.id %>">
|
||||||
<div class="author">
|
<div class="author">
|
||||||
<h4><%= link_to forum_post.creator.name, user_path(forum_post.creator_id) %></h4>
|
<h4>
|
||||||
|
<%= link_to forum_post.creator.name, user_path(forum_post.creator_id) %>
|
||||||
|
<% if forum_post.is_deleted? %>
|
||||||
|
(deleted)
|
||||||
|
<% end %>
|
||||||
|
</h4>
|
||||||
<p>
|
<p>
|
||||||
<%= time_ago_in_words(forum_post.created_at) %> ago
|
<%= time_ago_in_words(forum_post.created_at) %> ago
|
||||||
</p>
|
</p>
|
||||||
@@ -12,7 +17,11 @@
|
|||||||
<menu>
|
<menu>
|
||||||
<li><%= link_to "Quote", new_forum_post_path(:post_id => forum_post.id) %></li>
|
<li><%= link_to "Quote", new_forum_post_path(:post_id => forum_post.id) %></li>
|
||||||
<% if CurrentUser.user.is_janitor? || CurrentUser.user.id == forum_post.creator_id %>
|
<% if CurrentUser.user.is_janitor? || CurrentUser.user.id == forum_post.creator_id %>
|
||||||
<li><%= link_to "Delete", forum_post_path(forum_post.id), :confirm => "Do you really want to delete this post?", :method => :delete, :remote => true %></li>
|
<% if forum_post.is_deleted %>
|
||||||
|
<li><%= link_to "Undelete", undelete_forum_post_path(forum_post.id), :method => :post, :remote => true %></li>
|
||||||
|
<% else %>
|
||||||
|
<li><%= link_to "Delete", forum_post_path(forum_post.id), :confirm => "Do you really want to delete this post?", :method => :delete, :remote => true %></li>
|
||||||
|
<% end %>
|
||||||
<li><%= link_to "Edit", edit_forum_post_path(forum_post.id) %></li>
|
<li><%= link_to "Edit", edit_forum_post_path(forum_post.id) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
1
app/views/forum_posts/undelete.js.erb
Normal file
1
app/views/forum_posts/undelete.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
location.reload();
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<div id="c-forum-topics">
|
<div id="c-forum-topics">
|
||||||
<div id="a-show">
|
<div id="a-show">
|
||||||
<h1>Topic: <%= @forum_topic.title %></h1>
|
<h1>
|
||||||
|
Topic: <%= @forum_topic.title %>
|
||||||
|
<% if @forum_topic.is_deleted? %>
|
||||||
|
(deleted)
|
||||||
|
<% end %>
|
||||||
|
</h1>
|
||||||
|
|
||||||
<% if @forum_topic.is_locked? %>
|
<% if @forum_topic.is_locked? %>
|
||||||
<div class="notice">
|
<div class="notice">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
<%= f.input :description %>
|
<%= f.input :description %>
|
||||||
<%= f.input :post_ids, :label => "Posts" %>
|
<%= f.input :post_ids, :label => "Posts" %>
|
||||||
|
<%= f.input :is_active %>
|
||||||
<%= f.button :submit %>
|
<%= f.button :submit %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,11 +75,18 @@ Danbooru::Application.routes.draw do
|
|||||||
resource :dtext_preview, :only => [:create]
|
resource :dtext_preview, :only => [:create]
|
||||||
resources :favorites
|
resources :favorites
|
||||||
resources :forum_posts do
|
resources :forum_posts do
|
||||||
|
member do
|
||||||
|
post :undelete
|
||||||
|
end
|
||||||
collection do
|
collection do
|
||||||
get :search
|
get :search
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :forum_topics
|
resources :forum_topics do
|
||||||
|
member do
|
||||||
|
post :undelete
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :ip_bans
|
resources :ip_bans
|
||||||
resources :janitor_trials do
|
resources :janitor_trials do
|
||||||
collection do
|
collection do
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class CreateForumTopics < ActiveRecord::Migration
|
|||||||
t.column :response_count, :integer, :null => false, :default => 0
|
t.column :response_count, :integer, :null => false, :default => 0
|
||||||
t.column :is_sticky, :boolean, :null => false, :default => false
|
t.column :is_sticky, :boolean, :null => false, :default => false
|
||||||
t.column :is_locked, :boolean, :null => false, :default => false
|
t.column :is_locked, :boolean, :null => false, :default => false
|
||||||
|
t.column :is_deleted, :boolean, :null => false, :default => false
|
||||||
t.column :text_index, "tsvector", :null => false
|
t.column :text_index, "tsvector", :null => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class CreateForumPosts < ActiveRecord::Migration
|
|||||||
t.column :updater_id, :integer, :null => false
|
t.column :updater_id, :integer, :null => false
|
||||||
t.column :body, :text, :null => false
|
t.column :body, :text, :null => false
|
||||||
t.column :text_index, "tsvector", :null => false
|
t.column :text_index, "tsvector", :null => false
|
||||||
|
t.column :is_deleted, :boolean, :null => false, :default => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2883,7 +2883,8 @@ CREATE TABLE forum_topics (
|
|||||||
text_index tsvector NOT NULL,
|
text_index tsvector NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone,
|
updated_at timestamp without time zone,
|
||||||
original_post_id integer not null
|
original_post_id integer not null,
|
||||||
|
is_deleted boolean DEFAULT false NOT NULL
|
||||||
);
|
);
|
||||||
CREATE SEQUENCE forum_topics_id_seq
|
CREATE SEQUENCE forum_topics_id_seq
|
||||||
START WITH 1
|
START WITH 1
|
||||||
@@ -2904,7 +2905,7 @@ CREATE TRIGGER trigger_forum_topics_on_update
|
|||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'title');
|
EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'title');
|
||||||
update forum_posts set creator_id = 1 where creator_id is null;
|
update forum_posts set creator_id = 1 where creator_id is null;
|
||||||
insert into forum_topics (creator_id, updater_id, title, response_count, is_sticky, is_locked, text_index, created_at, updated_at, original_post_id) select forum_posts.creator_id, forum_posts.creator_id, forum_posts.title, forum_posts.response_count, forum_posts.is_sticky, forum_posts.is_locked, forum_posts.text_search_index, forum_posts.created_at, forum_posts.updated_at, forum_posts.id from forum_posts where parent_id is null;
|
insert into forum_topics (creator_id, updater_id, title, response_count, is_sticky, is_locked, text_index, created_at, updated_at, original_post_id, is_deleted) select forum_posts.creator_id, forum_posts.creator_id, forum_posts.title, forum_posts.response_count, forum_posts.is_sticky, forum_posts.is_locked, forum_posts.text_search_index, forum_posts.created_at, forum_posts.updated_at, forum_posts.id, forum_posts.is_deleted from forum_posts where parent_id is null;
|
||||||
|
|
||||||
alter table forum_posts drop constraint forum_posts_creator_id_fkey;
|
alter table forum_posts drop constraint forum_posts_creator_id_fkey;
|
||||||
alter table forum_posts drop constraint forum_posts_last_updated_by_fkey;
|
alter table forum_posts drop constraint forum_posts_last_updated_by_fkey;
|
||||||
|
|||||||
Reference in New Issue
Block a user