fixes #3757
This commit is contained in:
16
app/controllers/maintenance/user/count_fixes_controller.rb
Normal file
16
app/controllers/maintenance/user/count_fixes_controller.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
module Maintenance
|
||||||
|
module User
|
||||||
|
class CountFixesController < ApplicationController
|
||||||
|
before_action :member_only
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
CurrentUser.user.refresh_counts!
|
||||||
|
flash[:notice] = "Counts have been refreshed"
|
||||||
|
redirect_to user_path(CurrentUser.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -772,6 +772,16 @@ class User < ApplicationRecord
|
|||||||
def negative_feedback_count
|
def negative_feedback_count
|
||||||
feedback.negative.count
|
feedback.negative.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def refresh_counts!
|
||||||
|
self.class.without_timeout do
|
||||||
|
update(
|
||||||
|
post_upload_count: Post.for_user(id).count,
|
||||||
|
post_update_count: PostArchive.for_user(id).count,
|
||||||
|
note_update_count: NoteVersion.for_user(id).count
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
|
|||||||
15
app/views/maintenance/user/count_fixes/new.html.erb
Normal file
15
app/views/maintenance/user/count_fixes/new.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<div id="c-maintenance-user-count-fixes">
|
||||||
|
<div id="a-new">
|
||||||
|
<h1>Refresh Counts</h1>
|
||||||
|
|
||||||
|
<p>If you believe the upload counts on your profile are incorrect, you can request a refresh to recalculate the counts.</p>
|
||||||
|
|
||||||
|
<%= form_tag(maintenance_user_count_fixes_path) do %>
|
||||||
|
<%= submit_tag "Continue" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Refresh Counts - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -119,6 +119,7 @@
|
|||||||
<li><%= link_to("Signup", new_user_path) %></li>
|
<li><%= link_to("Signup", new_user_path) %></li>
|
||||||
<li><%= link_to("Terms of Service", terms_of_service_path) %></li>
|
<li><%= link_to("Terms of Service", terms_of_service_path) %></li>
|
||||||
<li><%= link_to("Upgrade Information", new_user_upgrade_path) %></li>
|
<li><%= link_to("Upgrade Information", new_user_upgrade_path) %></li>
|
||||||
|
<li><%= link_to("Refresh counts", new_maintenance_user_count_fixes) %>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li><h1>Admin</h1></li>
|
<li><h1>Admin</h1></li>
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
namespace :maintenance do
|
namespace :maintenance do
|
||||||
namespace :user do
|
namespace :user do
|
||||||
|
resource :count_fixes, only: [:new, :create]
|
||||||
resource :email_notification, :only => [:show, :destroy]
|
resource :email_notification, :only => [:show, :destroy]
|
||||||
resource :password_reset, :only => [:new, :create, :edit, :update]
|
resource :password_reset, :only => [:new, :create, :edit, :update]
|
||||||
resource :login_reminder, :only => [:new, :create]
|
resource :login_reminder, :only => [:new, :create]
|
||||||
|
|||||||
Reference in New Issue
Block a user