merge master into autocomplete-aliased-tags
This commit is contained in:
@@ -35,7 +35,7 @@ class BulkUpdateRequestsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
if @bulk_update_request.editable?(CurrentUser.user)
|
||||
@bulk_update_request.destroy
|
||||
@bulk_update_request.reject!
|
||||
flash[:notice] = "Bulk update request deleted"
|
||||
respond_with(@bulk_update_request, :location => bulk_update_requests_path)
|
||||
else
|
||||
|
||||
@@ -7,11 +7,6 @@ class TagAliasesController < ApplicationController
|
||||
respond_with(@tag_alias)
|
||||
end
|
||||
|
||||
def new
|
||||
@tag_alias = TagAlias.new(params[:tag_alias])
|
||||
respond_with(@tag_alias)
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag_alias = TagAlias.find(params[:id])
|
||||
end
|
||||
@@ -36,11 +31,6 @@ class TagAliasesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@tag_alias = TagAlias.create(params[:tag_alias])
|
||||
respond_with(@tag_alias, :location => tag_aliases_path(:search => {:id => @tag_alias.id}))
|
||||
end
|
||||
|
||||
def destroy
|
||||
@tag_alias = TagAlias.find(params[:id])
|
||||
if @tag_alias.deletable_by?(CurrentUser.user)
|
||||
|
||||
@@ -7,11 +7,6 @@ class TagImplicationsController < ApplicationController
|
||||
respond_with(@tag_implication)
|
||||
end
|
||||
|
||||
def new
|
||||
@tag_implication = TagImplication.new
|
||||
respond_with(@tag_implication)
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag_implication = TagImplication.find(params[:id])
|
||||
end
|
||||
@@ -36,11 +31,6 @@ class TagImplicationsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@tag_implication = TagImplication.create(params[:tag_implication])
|
||||
respond_with(@tag_implication, :location => tag_implications_path(:search => {:id => @tag_implication.id}))
|
||||
end
|
||||
|
||||
def destroy
|
||||
@tag_implication = TagImplication.find(params[:id])
|
||||
if @tag_implication.deletable_by?(CurrentUser.user)
|
||||
|
||||
@@ -16,7 +16,11 @@ class UploadsController < ApplicationController
|
||||
@normalized_url, headers = strategy.new(@normalized_url).rewrite(@normalized_url, headers)
|
||||
end
|
||||
|
||||
@post = Post.where(source: [params[:url], @normalized_url]).first
|
||||
if @normalized_url.nil?
|
||||
@post = Post.where(source: params[:url]).first
|
||||
else
|
||||
@post = Post.where(source: [params[:url], @normalized_url]).first
|
||||
end
|
||||
|
||||
begin
|
||||
@source = Sources::Site.new(params[:url])
|
||||
|
||||
@@ -48,12 +48,18 @@ private
|
||||
case token[0]
|
||||
when :create_alias
|
||||
tag_alias = TagAlias.create(:forum_topic_id => forum_id, :status => "pending", :antecedent_name => token[1], :consequent_name => token[2])
|
||||
unless tag_alias.valid?
|
||||
raise "Error: #{tag_alias.errors.full_messages.join("; ")} (create alias #{tag_alias.antecedent_name} -> #{tag_alias.consequent_name})"
|
||||
end
|
||||
tag_alias.rename_wiki_and_artist if rename_aliased_pages?
|
||||
tag_alias.delay(:queue => "default").process!
|
||||
tag_alias.delay(:queue => "default").process!(false)
|
||||
|
||||
when :create_implication
|
||||
tag_implication = TagImplication.create(:forum_topic_id => forum_id, :status => "pending", :antecedent_name => token[1], :consequent_name => token[2])
|
||||
tag_implication.delay(:queue => "default").process!
|
||||
unless tag_implication.valid?
|
||||
raise "Error: #{tag_implication.errors.full_messages.join("; ")} (create implication #{tag_implication.antecedent_name} -> #{tag_implication.consequent_name})"
|
||||
end
|
||||
tag_implication.delay(:queue => "default").process!(false)
|
||||
|
||||
when :remove_alias
|
||||
tag_alias = TagAlias.where("antecedent_name = ?", token[1]).first
|
||||
|
||||
@@ -47,12 +47,18 @@ module Sources
|
||||
end
|
||||
|
||||
def get_image_url_from_page(page)
|
||||
download_link = page.link_with(:class => /dev-page-download/)
|
||||
image = page.search("div.dev-view-deviation img.dev-content-full")
|
||||
|
||||
if download_link
|
||||
download_link.click.uri.to_s # need to follow the redirect now to get the full size url, following it later seems to not work.
|
||||
if image.any?
|
||||
image[0]["src"]
|
||||
else
|
||||
nil
|
||||
download_link = page.link_with(:class => /dev-page-download/)
|
||||
|
||||
if download_link
|
||||
download_link.click.uri.to_s # need to follow the redirect now to get the full size url, following it later seems to not work.
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ class BulkUpdateRequest < ActiveRecord::Base
|
||||
extend SearchMethods
|
||||
|
||||
def approve!
|
||||
update_forum_topic_for_approve
|
||||
AliasAndImplicationImporter.new(script, forum_topic_id, "1").process!
|
||||
update_forum_topic_for_approve
|
||||
update_attribute(:status, "approved")
|
||||
end
|
||||
|
||||
|
||||
@@ -668,7 +668,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def has_tag?(tag)
|
||||
!!(tag_string =~ /(?:^| )#{tag}(?:$| )/)
|
||||
!!(tag_string =~ /(?:^| )(?:#{tag})(?:$| )/)
|
||||
end
|
||||
|
||||
def has_dup_tag?
|
||||
|
||||
@@ -77,7 +77,7 @@ class TagAlias < ActiveRecord::Base
|
||||
end.uniq
|
||||
end
|
||||
|
||||
def process!
|
||||
def process!(update_topic=true)
|
||||
unless valid?
|
||||
raise errors.full_messages.join("; ")
|
||||
end
|
||||
@@ -86,7 +86,7 @@ class TagAlias < ActiveRecord::Base
|
||||
clear_all_cache
|
||||
ensure_category_consistency
|
||||
update_posts
|
||||
update_forum_topic_for_approve
|
||||
update_forum_topic_for_approve if update_topic
|
||||
update_column(:post_count, consequent_tag.post_count)
|
||||
update_column(:status, "active")
|
||||
rescue Exception => e
|
||||
|
||||
@@ -120,7 +120,7 @@ class TagImplication < ActiveRecord::Base
|
||||
self.creator_ip_addr = CurrentUser.ip_addr
|
||||
end
|
||||
|
||||
def process!
|
||||
def process!(update_topic=true)
|
||||
unless valid?
|
||||
raise errors.full_messages.join("; ")
|
||||
end
|
||||
@@ -128,7 +128,7 @@ class TagImplication < ActiveRecord::Base
|
||||
update_posts
|
||||
update_column(:status, "active")
|
||||
update_descendant_names_for_parents
|
||||
update_forum_topic_for_approve
|
||||
update_forum_topic_for_approve if update_topic
|
||||
rescue Exception => e
|
||||
update_column(:status, "error: #{e}")
|
||||
end
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
<menu>
|
||||
<li><%= link_to "Listing", tag_aliases_path %></li>
|
||||
<li><%= link_to "MetaSearch", meta_searches_tags_path %></li>
|
||||
<% if CurrentUser.is_admin? %>
|
||||
<li><%= link_to "New", new_tag_alias_path %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Request alias", new_tag_alias_request_path %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "Request alias", new_tag_alias_request_path %></li>
|
||||
<li><%= link_to "Request bulk update", new_bulk_update_request_path %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_aliases") %></li>
|
||||
</menu>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<div id="c-tag-aliases">
|
||||
<div id="a-new">
|
||||
<h1>New Tag Alias</h1>
|
||||
|
||||
<%= error_messages_for :tag_alias %>
|
||||
|
||||
<%= simple_form_for(@tag_alias) do |f| %>
|
||||
<%= f.input :status, :value => "pending", :as => :hidden %>
|
||||
<%= f.input :antecedent_name, :as => :string, :label => "From" %>
|
||||
<%= f.input :consequent_name, :label => "To" %>
|
||||
<%= f.input :forum_topic_id, :label => "Forum" %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
New Tag Alias - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
@@ -2,11 +2,7 @@
|
||||
<menu>
|
||||
<li><%= link_to "Listing", tag_implications_path %></li>
|
||||
<li><%= link_to "MetaSearch", meta_searches_tags_path %></li>
|
||||
<% if CurrentUser.is_admin? %>
|
||||
<li><%= link_to "New", new_tag_implication_path %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Request implication", new_tag_implication_request_path %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "Request implication", new_tag_implication_request_path %></li>
|
||||
<li><%= link_to "Request bulk update", new_bulk_update_request_path %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_implications") %></li>
|
||||
</menu>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<div id="c-tag-aliases">
|
||||
<div id="a-new">
|
||||
<h1>New Tag Implication</h1>
|
||||
|
||||
<%= error_messages_for :tag_implication %>
|
||||
|
||||
<%= simple_form_for(@tag_implication) do |f| %>
|
||||
<%= f.input :status, :value => "pending", :as => :hidden %>
|
||||
<%= f.input :antecedent_name, :label => "From" %>
|
||||
<%= f.input :consequent_name, :label => "To" %>
|
||||
<%= f.input :forum_topic_id, :label => "Forum" %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
New Tag Implication - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
@@ -4,7 +4,7 @@ module Danbooru
|
||||
class Configuration
|
||||
# The version of this Danbooru.
|
||||
def version
|
||||
"2.75.3"
|
||||
"2.76.0"
|
||||
end
|
||||
|
||||
# The name of this Danbooru.
|
||||
|
||||
Reference in New Issue
Block a user