diff --git a/app/controllers/tag_alias_corrections_controller.rb b/app/controllers/tag_alias_corrections_controller.rb deleted file mode 100644 index cf7ecc683..000000000 --- a/app/controllers/tag_alias_corrections_controller.rb +++ /dev/null @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8dcf75162..710aaa79a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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" diff --git a/app/logical/tag_alias_correction.rb b/app/logical/tag_alias_correction.rb deleted file mode 100644 index 440d41a52..000000000 --- a/app/logical/tag_alias_correction.rb +++ /dev/null @@ -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 diff --git a/app/views/meta_searches/tags.html.erb b/app/views/meta_searches/tags.html.erb index bc227b4f6..33704598f 100644 --- a/app/views/meta_searches/tags.html.erb +++ b/app/views/meta_searches/tags.html.erb @@ -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 %> <% end %> diff --git a/app/views/tag_alias_corrections/show.html.erb b/app/views/tag_alias_corrections/show.html.erb deleted file mode 100644 index 5adc37265..000000000 --- a/app/views/tag_alias_corrections/show.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -
-
-

Tag Alias Correction: <%= @correction.antecedent_name %> -> <%= @correction.consequent_name %>

- -

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.

- -
-
    -
  • <%= link_to @correction.antecedent_name, posts_path(:tags => @correction.antecedent_name, :raw => true) %> aliased to <%= @correction.statistics_hash["antecedent_cache"] %> in cache
  • -
  • <%= @correction.consequent_name %> aliased to <%= @correction.statistics_hash["consequent_cache"] %> in cache
  • -
  • <%= @correction.antecedent_name %> count is <%= @correction.statistics_hash["antecedent_count"] %>
  • -
  • <%= @correction.consequent_name %> count is <%= @correction.statistics_hash["consequent_count"] %>
  • -
-
- -

You can try to fix this alias. This will clear the cache and re-save all posts associated with <%= @correction.antecedent_name %>.

- - <%= form_tag(tag_alias_correction_path(:tag_alias_id => @correction.tag_alias_id)) do %> - <%= submit_tag "Fix" %> - <%= submit_tag "Cancel" %> - <% end %> -
-
- -<%= render "tag_aliases/secondary_links" %> - -<% content_for(:page_title) do %> - Tag Alias Correction - <%= Danbooru.config.app_name %> -<% end %> \ No newline at end of file diff --git a/app/views/tag_alias_corrections/show.json.erb b/app/views/tag_alias_corrections/show.json.erb deleted file mode 100644 index 65fa82d7a..000000000 --- a/app/views/tag_alias_corrections/show.json.erb +++ /dev/null @@ -1 +0,0 @@ -<%= raw @correction.to_json %> diff --git a/app/views/tag_aliases/_listing.html.erb b/app/views/tag_aliases/_listing.html.erb index 41aec5c86..798acbdd9 100644 --- a/app/views/tag_aliases/_listing.html.erb +++ b/app/views/tag_aliases/_listing.html.erb @@ -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 %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 079ce3215..9b1bddd37 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -268,7 +268,6 @@ Rails.application.routes.draw do end end resources :tag_aliases do - resource :correction, :controller => "tag_alias_corrections" member do post :approve end diff --git a/test/unit/tag_alias_correction_test.rb b/test/unit/tag_alias_correction_test.rb deleted file mode 100644 index 0a41843cc..000000000 --- a/test/unit/tag_alias_correction_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'test_helper' - -class TagAliasCorrectionTest < ActiveSupport::TestCase - context "A tag alias correction" do - setup do - @mod = FactoryBot.create(:moderator_user) - CurrentUser.user = @mod - CurrentUser.ip_addr = "127.0.0.1" - @post = FactoryBot.create(:post, :tag_string => "aaa") - @tag_alias = FactoryBot.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb") - @tag_alias.update_posts - end - - teardown do - CurrentUser.user = nil - CurrentUser.ip_addr = nil - end - - context "with a bad post count" do - setup do - Tag.where(:name => "aaa").update_all("post_count = -3") - @correction = TagAliasCorrection.new(@tag_alias.id) - end - - should "have the correct statistics hash" do - assert_equal(-3, @correction.statistics_hash["antecedent_count"]) - assert_equal(1, @correction.statistics_hash["consequent_count"]) - end - - should "render to json" do - assert_nothing_raised do - @correction.to_json - end - - assert_nothing_raised do - JSON.parse(@correction.to_json) - end - end - - context "that is fixed" do - setup do - @correction.fix! - end - - should "now have the correct count" do - assert_equal(0, Tag.find_by_name("aaa").post_count) - end - end - end - end -end