Fix #4130: Remove tag alias corrections.
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
class TagAliasCorrectionsController < ApplicationController
|
||||
before_action :builder_only, only: [:create]
|
||||
|
||||
def create
|
||||
@correction = TagAliasCorrection.new(params[:tag_alias_id])
|
||||
|
||||
if params[:commit] == "Fix"
|
||||
@correction.fix!
|
||||
flash[:notice] = "The fix has been queued and will be processed"
|
||||
end
|
||||
|
||||
redirect_to tag_alias_correction_path(:tag_alias_id => params[:tag_alias_id])
|
||||
end
|
||||
|
||||
def show
|
||||
@correction = TagAliasCorrection.new(params[:tag_alias_id])
|
||||
end
|
||||
end
|
||||
@@ -261,7 +261,7 @@ protected
|
||||
when "moderator/dashboards"
|
||||
/^\/moderator/
|
||||
|
||||
when "tag_aliases", "tag_alias_corrections", "tag_alias_requests"
|
||||
when "tag_aliases", "tag_alias_requests"
|
||||
/^\/tag_aliases/
|
||||
|
||||
when "tag_implications", "tag_implication_requests"
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
class TagAliasCorrection
|
||||
attr_reader :tag_alias_id, :tag_alias
|
||||
delegate :antecedent_name, :consequent_name, :to => :tag_alias
|
||||
|
||||
def initialize(tag_alias_id)
|
||||
@tag_alias_id = tag_alias_id
|
||||
@tag_alias = TagAlias.find(tag_alias_id)
|
||||
end
|
||||
|
||||
def to_json(options = {})
|
||||
statistics_hash.to_json
|
||||
end
|
||||
|
||||
def statistics_hash
|
||||
@statistics_hash ||= {
|
||||
"antecedent_count" => Tag.find_by_name(tag_alias.antecedent_name).try(:post_count),
|
||||
"consequent_count" => Tag.find_by_name(tag_alias.consequent_name).try(:post_count)
|
||||
}
|
||||
end
|
||||
|
||||
def fix!
|
||||
tag_alias.delay(:queue => "default").update_posts
|
||||
end
|
||||
end
|
||||
@@ -33,9 +33,6 @@
|
||||
<% if tag.editable_by?(CurrentUser.user) %>
|
||||
<%= link_to "edit", edit_tag_path(tag) %>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_builder? %>
|
||||
| <%= link_to "fix", new_tag_correction_path(:tag_id => tag.id) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<div id="c-tag-alias-corrections">
|
||||
<div id="a-show">
|
||||
<h1>Tag Alias Correction: <%= @correction.antecedent_name %> -> <%= @correction.consequent_name %></h1>
|
||||
|
||||
<p>Because tag aliases are cached in memory, they may go out of sync. This action will clear out the cache and fix any lingering posts.</p>
|
||||
|
||||
<div style="margin-bottom: 1em;">
|
||||
<ul>
|
||||
<li><strong><%= link_to @correction.antecedent_name, posts_path(:tags => @correction.antecedent_name, :raw => true) %></strong> aliased to <strong><%= @correction.statistics_hash["antecedent_cache"] %></strong> in cache</li>
|
||||
<li><strong><%= @correction.consequent_name %></strong> aliased to <strong><%= @correction.statistics_hash["consequent_cache"] %></strong> in cache</li>
|
||||
<li><strong><%= @correction.antecedent_name %></strong> count is <%= @correction.statistics_hash["antecedent_count"] %></li>
|
||||
<li><strong><%= @correction.consequent_name %></strong> count is <%= @correction.statistics_hash["consequent_count"] %></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>You can try to fix this alias. This will clear the cache and re-save all posts associated with <strong><%= @correction.antecedent_name %></strong>.</p>
|
||||
|
||||
<%= form_tag(tag_alias_correction_path(:tag_alias_id => @correction.tag_alias_id)) do %>
|
||||
<%= submit_tag "Fix" %>
|
||||
<%= submit_tag "Cancel" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "tag_aliases/secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Tag Alias Correction - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
@@ -1 +0,0 @@
|
||||
<%= raw @correction.to_json %>
|
||||
@@ -37,10 +37,6 @@
|
||||
<% if CurrentUser.is_admin? && tag_alias.is_pending? %>
|
||||
| <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %>
|
||||
<% end %>
|
||||
|
||||
<% if CurrentUser.is_builder? %>
|
||||
| <%= link_to "Fix", tag_alias_correction_path(:tag_alias_id => tag_alias.id) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user