diff --git a/app/controllers/user_reverts_controller.rb b/app/controllers/user_reverts_controller.rb
deleted file mode 100644
index a4bc94015..000000000
--- a/app/controllers/user_reverts_controller.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class UserRevertsController < ApplicationController
- before_action :moderator_only
-
- def new
- @user = User.find(params[:user_id])
- end
-
- def create
- user = User.find(params[:user_id])
- revert = UserRevert.new(user.id)
- revert.process
- redirect_to(user_path(user.id))
- end
-end
-
diff --git a/app/logical/user_revert.rb b/app/logical/user_revert.rb
deleted file mode 100644
index ba104d691..000000000
--- a/app/logical/user_revert.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# reverts all changes made by a user
-class UserRevert
- THRESHOLD = 1_000
- class TooManyChangesError < RuntimeError ; end
-
- attr_reader :user_id
-
- def initialize(user_id)
- @user_id = user_id
- end
-
- def process
- validate!
- revert_post_changes
- end
-
- def validate!
- if PostArchive.where(updater_id: user_id).count > THRESHOLD
- raise TooManyChangesError.new("This user has too many changes to be reverted")
- end
- end
-
- def revert_post_changes
- PostArchive.where(updater_id: user_id).find_each do |x|
- x.undo!
- end
- end
-
- def self.can_revert?(user)
- user.post_update_count <= THRESHOLD
- end
-end
diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb
index 98f03f17a..1e16701b1 100644
--- a/app/presenters/user_presenter.rb
+++ b/app/presenters/user_presenter.rb
@@ -101,7 +101,7 @@ class UserPresenter
end
def post_version_count(template)
- template.link_to(user.post_update_count, template.post_versions_path(:lr => user.id, :search => {:updater_id => user.id}))
+ template.link_to(user.post_update_count, template.post_versions_path(:search => {:updater_id => user.id}))
end
def note_version_count(template)
diff --git a/app/views/post_versions/index.html.erb b/app/views/post_versions/index.html.erb
index 02afe6d3d..bda714bc5 100644
--- a/app/views/post_versions/index.html.erb
+++ b/app/views/post_versions/index.html.erb
@@ -13,10 +13,6 @@
<%= render "standard_listing" %>
<% end %>
- <% if params[:lr] && CurrentUser.is_moderator? %>
-
<%= link_to "Revert this user's changes", new_user_revert_path(:user_id => params[:lr]) %>
- <% end %>
-
<%= numbered_paginator(@post_versions) %>
<% end %>
diff --git a/app/views/static/site_map.html.erb b/app/views/static/site_map.html.erb
index 83569d083..7230f56f4 100644
--- a/app/views/static/site_map.html.erb
+++ b/app/views/static/site_map.html.erb
@@ -78,7 +78,6 @@
<% if Danbooru.config.reportbooru_server %>
<%= link_to("Top Searches", searches_explore_posts_path) %>
<%= link_to("Missed Searches", missed_searches_explore_posts_path) %>
- <%= link_to("Post Changes", reports_post_versions_path) %>
<% end %>
diff --git a/app/views/user_reverts/new.html.erb b/app/views/user_reverts/new.html.erb
deleted file mode 100644
index a393c11ff..000000000
--- a/app/views/user_reverts/new.html.erb
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
Revert Changes
-
-
You are about to revert all changes made by <%= link_to_user @user %>. Continue?
-
- <%= form_tag(user_revert_path) do %>
- <%= hidden_field_tag :user_id, params[:user_id] %>
-
- <%= submit_tag "Yes" %>
- <% end %>
-
-
-
-<%= render "users/secondary_links" %>
diff --git a/app/views/users/_statistics.html.erb b/app/views/users/_statistics.html.erb
index 227c380c4..611440e75 100644
--- a/app/views/users/_statistics.html.erb
+++ b/app/views/users/_statistics.html.erb
@@ -94,9 +94,6 @@
Post Changes |
<%= presenter.post_version_count(self) %>
- <% if CurrentUser.is_moderator? && UserRevert.can_revert?(user)%>
- (<%= link_to "revert all", new_user_revert_path(user_id: user.id) %>)
- <% end %>
<% if CurrentUser.id == user.id %>
(<%= link_to "refresh", new_maintenance_user_count_fixes_path %>)
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 99d5ff75b..f1770c0f9 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -244,8 +244,6 @@ Rails.application.routes.draw do
resource :related_tag, :only => [:show, :update]
get "reports/uploads" => "reports#uploads"
get "reports/upload_tags" => "reports#upload_tags"
- get "reports/post_versions" => "reports#post_versions"
- post "reports/post_versions_create" => "reports#post_versions_create"
get "reports/down_voting_post" => "reports#down_voting_post"
post "reports/down_voting_post_create" => "reports#down_voting_post_create"
resource :recommended_posts, only: [:show]
@@ -300,7 +298,6 @@ Rails.application.routes.draw do
end
end
resources :user_name_change_requests, only: [:new, :create, :show, :index]
- resource :user_revert, :only => [:new, :create]
resources :wiki_pages do
member do
put :revert
diff --git a/test/unit/user_revert_test.rb b/test/unit/user_revert_test.rb
deleted file mode 100644
index 70a1aeec9..000000000
--- a/test/unit/user_revert_test.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-require 'test_helper'
-
-class UserRevertTest < ActiveSupport::TestCase
- context "Reverting a user's changes" do
- setup do
- @creator = create(:user)
- @user = create(:user)
-
- CurrentUser.scoped(@creator) do
- @parent = create(:post)
- @post = create(:post, :tag_string => "aaa bbb ccc", :rating => "q", :source => "xyz")
- end
-
- @post.stubs(:merge_version?).returns(false)
- CurrentUser.scoped(@user) do
- @post.update(:tag_string => "bbb ccc xxx", :source => "", :rating => "e")
- end
- end
-
- subject { UserRevert.new(@user.id) }
-
- should "have the correct data" do
- assert_equal("bbb ccc xxx", @post.tag_string)
- assert_equal("", @post.source)
- assert_equal("e", @post.rating)
- end
-
- context "when processed" do
- setup do
- CurrentUser.as(@user) do
- subject.process
- end
- @post.reload
- end
-
- should "revert the user's changes" do
- assert_equal("aaa bbb ccc", @post.tag_string)
- assert_equal("xyz", @post.source)
- assert_equal("q", @post.rating)
- end
- end
-
- end
-end
|