fix pool metatags, fix artist search
This commit is contained in:
@@ -33,7 +33,6 @@ class BansController < ApplicationController
|
|||||||
if @ban.update_attributes(params[:ban])
|
if @ban.update_attributes(params[:ban])
|
||||||
redirect_to ban_path(@ban), :notice => "Ban updated"
|
redirect_to ban_path(@ban), :notice => "Ban updated"
|
||||||
else
|
else
|
||||||
puts @ban.errors.full_messages
|
|
||||||
render :action => "edit"
|
render :action => "edit"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_last_commented_at
|
def update_last_commented_at
|
||||||
puts Comment.where("post_id = ?", post_id).count
|
|
||||||
puts !do_not_bump_post?
|
|
||||||
if Comment.where("post_id = ?", post_id).count == 0
|
if Comment.where("post_id = ?", post_id).count == 0
|
||||||
Post.update_all("last_commented_at = NULL", ["id = ?", post_id])
|
Post.update_all("last_commented_at = NULL", ["id = ?", post_id])
|
||||||
elsif Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post?
|
elsif Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post?
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class Post < ActiveRecord::Base
|
|||||||
after_destroy :delete_remote_files
|
after_destroy :delete_remote_files
|
||||||
after_save :create_version
|
after_save :create_version
|
||||||
after_save :update_parent_on_save
|
after_save :update_parent_on_save
|
||||||
|
after_save :apply_metatags, :on => :create
|
||||||
before_save :merge_old_tags
|
before_save :merge_old_tags
|
||||||
before_save :normalize_tags
|
before_save :normalize_tags
|
||||||
before_save :create_tags
|
before_save :create_tags
|
||||||
@@ -380,13 +381,15 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filter_metatags(tags)
|
def filter_metatags(tags)
|
||||||
metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|rating|fav|parent):/}
|
@metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|rating|fav|parent):/}
|
||||||
apply_metatags(metatags)
|
apply_metatags
|
||||||
return tags
|
return tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_metatags(tags)
|
def apply_metatags
|
||||||
tags.each do |tag|
|
return unless @metatags.is_a?(Array)
|
||||||
|
|
||||||
|
@metatags.each do |tag|
|
||||||
case tag
|
case tag
|
||||||
when /^parent:none$/, /^parent:0$/
|
when /^parent:none$/, /^parent:0$/
|
||||||
self.parent_id = nil
|
self.parent_id = nil
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module Danbooru
|
|||||||
module Extensions
|
module Extensions
|
||||||
module String
|
module String
|
||||||
def to_escaped_for_sql_like
|
def to_escaped_for_sql_like
|
||||||
return self.gsub(/\\/, '\0\0').gsub(/(%|_)/, '\\\\\\1').gsub(/_/, '\\_').gsub(/\*/, '%')
|
return self.gsub(/\\/, '\0\0').gsub(/(%|_)/, "\\\\\\1").gsub(/\*/, '%')
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_escaped_js
|
def to_escaped_js
|
||||||
|
|||||||
Reference in New Issue
Block a user