Convert platinum -> contributor for user rank

This commit is contained in:
Kira 2019-06-29 12:06:13 -07:00
parent e2f15d0898
commit 16af051931
12 changed files with 18 additions and 27 deletions

View File

@ -3,7 +3,7 @@ module Admin::UsersHelper
options = [
["Member", User::Levels::MEMBER],
["Privileged", User::Levels::PRIVILEGED],
["Platinum", User::Levels::CONTRIBUTOR],
["Contributor", User::Levels::CONTRIBUTOR],
["Builder", User::Levels::JANITOR],
["Moderator", User::Levels::MODERATOR],
["Admin", User::Levels::ADMIN]

View File

@ -5,7 +5,7 @@ module Moderator
["", ""],
["Member", 20],
["Privileged", 30],
["Platinum", 31],
["Contributor", 31],
["Moderator", 40],
["Admin", 50]
]

View File

@ -14,7 +14,7 @@ a.user-builder.with-style {
color: #6633FF;
}
a.user-platinum.with-style {
a.user-contributor.with-style {
color: gray;
}

View File

@ -250,7 +250,7 @@ class User < ApplicationRecord
return {
"Member" => Levels::MEMBER,
"Privileged" => Levels::PRIVILEGED,
"Platinum" => Levels::CONTRIBUTOR,
"Contributor" => Levels::CONTRIBUTOR,
"Builder" => Levels::JANITOR,
"Moderator" => Levels::MODERATOR,
"Admin" => Levels::ADMIN
@ -275,7 +275,7 @@ class User < ApplicationRecord
"Privileged"
when Levels::CONTRIBUTOR
"Platinum"
"Contributor"
when Levels::MODERATOR
"Moderator"
@ -341,7 +341,7 @@ class User < ApplicationRecord
level >= Levels::PRIVILEGED
end
def is_platinum?
def is_contributor?
level >= Levels::CONTRIBUTOR
end
@ -467,7 +467,7 @@ class User < ApplicationRecord
end
def general_should_throttle?
!is_platinum?
!is_contributor?
end
create_user_throttle(:artist_edit, ->{ Danbooru.config.artist_edit_limit - ArtistVersion.for_user(id).where('updated_at > ?', 1.hour.ago).count },
@ -492,7 +492,7 @@ class User < ApplicationRecord
nil, nil)
def max_saved_searches
if is_platinum?
if is_contributor?
1_000
else
250
@ -532,7 +532,7 @@ class User < ApplicationRecord
true # TODO: Remove this?
elsif created_at > 1.week.ago
:REJ_UPLOAD_NEWBIE
elsif !is_platinum? && post_edit_limit <= 0
elsif !is_privileged? && post_edit_limit <= 0
:REJ_UPLOAD_EDIT
elsif upload_limit <= 0
:REJ_UPLOAD_LIMIT
@ -577,7 +577,7 @@ class User < ApplicationRecord
end
def favorite_limit
if is_platinum?
if is_contributor?
40_000
elsif is_privileged?
20_000
@ -588,7 +588,7 @@ class User < ApplicationRecord
def api_regen_multiplier
# regen this amount per second
if is_platinum?
if is_contributor?
4
elsif is_privileged?
2
@ -600,7 +600,7 @@ class User < ApplicationRecord
def api_burst_limit
# can make this many api calls at once before being bound by
# api_regen_multiplier refilling your pool
if is_platinum?
if is_contributor?
60
elsif is_privileged?
30
@ -614,7 +614,7 @@ class User < ApplicationRecord
end
def statement_timeout
if is_platinum?
if is_contributor?
9_000
elsif is_privileged?
6_000

View File

@ -120,7 +120,6 @@
<li><%= link_to("Feedback", user_feedbacks_path) %></li>
<li><%= link_to("Signup", new_user_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("Refresh counts", new_maintenance_user_count_fixes_path) %>
</ul>
<ul>

View File

@ -14,15 +14,8 @@
<%= subnav_link_to "Settings", edit_user_path(CurrentUser.user) %>
<%= subnav_link_to "Profile", user_path(CurrentUser.user) %>
<%= subnav_link_to "Messages #{CurrentUser.user.dmail_count}", dmails_current_folder_path %>
<% if !@user.is_platinum? %>
<%= subnav_link_to "Upgrade", new_user_upgrade_path %>
<% end %>
<% else %>
<%= subnav_link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %>
<% if !@user.is_platinum? %>
<%= subnav_link_to "Gift upgrade", new_user_upgrade_path(:user_id => @user.id) %>
<% end %>
<%= subnav_link_to "Report", new_ticket_path(disp_id: @user.id, type: 'user') %>
<% end %>

View File

@ -2,7 +2,7 @@
<div id="a-new">
<h1>Sign Up</h1>
<p>A basic account is <strong>free</strong> and lets you keep favorites, upload artwork, and write comments. If you want <%= link_to "more features", new_user_upgrade_path %> you can upgrade your account later.</p>
<p>A basic account is <strong>free</strong> and lets you keep favorites, upload artwork, and write comments.</p>
<h1 style="margin-bottom: 1em;">This site is open to web crawlers so whatever name you choose will be public!</h1>

View File

@ -29,7 +29,7 @@
<ul>
<li>Remaining hourly uploads: <%= CurrentUser.hourly_upload_limit %></li>
<% if !CurrentUser.is_platinum? %><li>Remaining hourly tag edits: <%= CurrentUser.post_edit_limit %></li><% end %>
<% if !CurrentUser.is_privileged? %><li>Remaining hourly tag edits: <%= CurrentUser.post_edit_limit %></li><% end %>
</ul>
<% unless CurrentUser.can_upload_free? %>

View File

@ -340,7 +340,6 @@ Rails.application.routes.draw do
get :custom_style
end
end
resource :user_upgrade, :only => [:new, :create, :show]
resources :user_feedbacks do
collection do
get :search

View File

@ -9,7 +9,7 @@
<body>
<div style="text-align: center; margin-top: 5em;">
<p style="width: 40em; margin: auto;">The server is currently overloaded.</p>
<p style="width: 40em; margin: auto;"> This page will automatically refresh in one minute.</p>
<p style="width: 40em; margin: auto;">This page will automatically refresh in one minute.</p>
</div>
</body>
</html>

View File

@ -9,7 +9,7 @@ ModAction.transaction do
ModAction.without_timeout do
# Find mod actions where the user changed their own level.
mod_actions = ModAction.where(category: :user_level_change).select do |mod_action|
mod_action.description.match?(%r{".*":/users/#{mod_action.creator_id} level changed \w+ -> (Privileged|Platinum)}i)
mod_action.description.match?(%r{".*":/users/#{mod_action.creator_id} level changed \w+ -> (Privileged|Contributor)}i)
end
ModAction.where(id: mod_actions).update_all(category: :user_account_upgrade)

View File

@ -27,7 +27,7 @@ FactoryBot.define do
level 30
end
factory(:platinum_user) do
factory(:contributor_user) do
level 31
end