Compare commits

..

No commits in common. "ab238ab2a654afd7a322f8cda177fe4e613135bb" and "d9bf4f745b12f7a9cd06b72eb0e036b0b3db01e8" have entirely different histories.

6 changed files with 14 additions and 41 deletions

View file

@ -4,7 +4,7 @@ require 'async/container'
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user, :support_staff?, :user_signed_in?
helper_method :current_user, :user_signed_in?
before_action :set_locale
@ -111,12 +111,10 @@ class ApplicationController < ActionController::Base
return_to || root_path
end
def support_staff?
current_user&.support_staff?
end
def support_staff_only
raise AccessDenied, "Support staff only" unless support_staff?
unless current_user&.support_staff?
raise AccessDenied, "Support staff only"
end
end
end

View file

@ -35,7 +35,10 @@ class PetStatesController < ApplicationController
end
def next_unlabeled_appearance_path
unlabeled_appearance = PetState.next_unlabeled_appearance
# Rather than just getting the newest unlabeled pet state, prioritize the
# newest *pet type*. This better matches the user's perception of what the
# newest state is, because the Rainbow Pool UI is grouped by pet type!
unlabeled_appearance = PetState.needs_labeling.newest_pet_type.newest.first
if unlabeled_appearance
edit_pet_type_pet_state_path(

View file

@ -35,16 +35,6 @@ class PetTypesController < ApplicationController
if @selected_species && @selected_color && @pet_types.size == 1
redirect_to @pet_types.first
end
if support_staff?
@counts = {
total: PetState.count,
glitched: PetState.glitched.count,
needs_labeling: PetState.needs_labeling.count,
usable: PetState.usable.count,
}
@unlabeled_appearance = PetState.next_unlabeled_appearance
end
}
format.json {

View file

@ -127,6 +127,10 @@ module ApplicationHelper
!@hide_home_link
end
def support_staff?
user_signed_in? && current_user.support_staff?
end
def impress_2020_meta_tags
origin = Rails.configuration.impress_2020_origin
support_secret = Rails.application.credentials.dig(

View file

@ -17,13 +17,10 @@ class PetState < ApplicationRecord
alias_method :swf_asset_ids_from_association, :swf_asset_ids
scope :glitched, -> { where(glitched: true) }
scope :needs_labeling, -> { unlabeled.where(glitched: false) }
scope :unlabeled, -> { with_pose("UNKNOWN") }
scope :usable, -> { where(labeled: true, glitched: false) }
scope :newest, -> { order(created_at: :desc) }
scope :newest_pet_type, -> { joins(:pet_type).merge(PetType.newest) }
scope :unlabeled, -> { with_pose("UNKNOWN") }
scope :needs_labeling, -> { unlabeled.where(glitched: false) }
# A simple ordering that tries to bring reliable pet states to the front.
scope :emotion_order, -> {
@ -141,12 +138,5 @@ class PetState < ApplicationRecord
end
end
end
def self.next_unlabeled_appearance
# Rather than just getting the newest unlabeled pet state, prioritize the
# newest *pet type*. This better matches the user's perception of what the
# newest state is, because the Rainbow Pool UI is grouped by pet type!
needs_labeling.newest_pet_type.newest.first
end
end

View file

@ -10,18 +10,6 @@
[1]: #{alt_styles_path}
- if support_staff?
%p
%strong 💡 Support summary:
✅ #{number_with_delimiter @counts[:usable]} usable
+ 👾 #{number_with_delimiter @counts[:glitched]} glitched
- if @unlabeled_appearance
+ ❓️
= link_to "#{number_with_delimiter @counts[:needs_labeling]} unknown",
edit_pet_type_pet_state_path(@unlabeled_appearance.pet_type,
@unlabeled_appearance, next: "unlabeled-appearance")
\= #{number_with_delimiter @counts[:total]} total
= form_with method: :get, class: "rainbow-pool-filters" do |form|
%fieldset
%legend Filter by: