Remove support for old "Nebula (fake)" April Fools color
This hasn't worked for a while anyway! Let's remove the bits of code where we deal with it, and the database field that signals it. (We also make a corresponding change in Impress 2020, so it doesn't crash trying to query based on the `prank` column.) I also ran this snippet to clear out all the Nebula stuff in the db: ```rb Color.transaction do nebula = Color.where(prank: true).find_by_name("Nebula") nebula.pet_types.includes(pet_states: :swf_assets).each do |pet_type| pet_type.pet_states.each do |pet_state| pet_state.parent_swf_asset_relationships.each do |psa| psa.swf_asset.destroy! psa.destroy! end pet_state.destroy! end pet_type.destroy! end nebula.destroy! end ```
This commit is contained in:
parent
d056a5e766
commit
d66f81c96b
7 changed files with 15 additions and 27 deletions
|
@ -47,7 +47,7 @@ class OutfitsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@colors = Color.funny.alphabetical
|
||||
@colors = Color.alphabetical
|
||||
@species = Species.alphabetical
|
||||
|
||||
# HACK: Skip this in development, because it's slow!
|
||||
|
|
|
@ -5,7 +5,6 @@ class Color < ApplicationRecord
|
|||
scope :basic, -> { where(basic: true) }
|
||||
scope :standard, -> { where(standard: true) }
|
||||
scope :nonstandard, -> { where(standard: false) }
|
||||
scope :funny, -> { order(:prank) unless pranks_funny? }
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
|
@ -14,10 +13,10 @@ class Color < ApplicationRecord
|
|||
end
|
||||
|
||||
def human_name
|
||||
if prank? && !Color.pranks_funny?
|
||||
unfunny_human_name + ' ' + I18n.translate('colors.prank_suffix')
|
||||
if name
|
||||
name.split(' ').map { |word| word.capitalize }.join(' ')
|
||||
else
|
||||
unfunny_human_name
|
||||
I18n.translate('colors.default_human_name')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,14 +26,6 @@ class Color < ApplicationRecord
|
|||
"species_id ASC").first
|
||||
end
|
||||
|
||||
def unfunny_human_name
|
||||
if name
|
||||
name.split(' ').map { |word| word.capitalize }.join(' ')
|
||||
else
|
||||
I18n.translate('colors.default_human_name')
|
||||
end
|
||||
end
|
||||
|
||||
def default_gender_presentation
|
||||
if name.downcase.ends_with? "boy"
|
||||
:masc
|
||||
|
@ -44,9 +35,4 @@ class Color < ApplicationRecord
|
|||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def self.pranks_funny?
|
||||
now = Time.now.in_time_zone('Pacific Time (US & Canada)')
|
||||
now.month == 4 && now.day == 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
%span.error-icon{title: "We haven't seen this item on this pet before."} ⚠️
|
||||
|
||||
= select_tag "preview[color_id]",
|
||||
options_from_collection_for_select(Color.funny.alphabetical,
|
||||
options_from_collection_for_select(Color.alphabetical,
|
||||
"id", "human_name", @selected_preview_pet_type.color_id)
|
||||
= select_tag "preview[species_id]",
|
||||
options_from_collection_for_select(Species.alphabetical,
|
||||
|
|
|
@ -36,7 +36,8 @@ en:
|
|||
blog: Blog
|
||||
contact: Contact
|
||||
email: Questions, comments, bugs
|
||||
copyright: Images © 1999–%{year} World of Neopets, Inc. All Rights Reserved.
|
||||
copyright:
|
||||
Images © 1999–%{year} World of Neopets, Inc. All Rights Reserved.
|
||||
Used With Permission
|
||||
|
||||
items:
|
||||
|
@ -167,8 +168,7 @@ en:
|
|||
submit: Save
|
||||
edit: Edit
|
||||
delete: Delete
|
||||
delete_confirmation:
|
||||
Are you sure you want to delete "%{list_name}"?
|
||||
delete_confirmation: Are you sure you want to delete "%{list_name}"?
|
||||
If you do, we'll delete all the items in it, too.
|
||||
remove_all:
|
||||
confirm: "Remove all items from this list?"
|
||||
|
@ -215,7 +215,6 @@ en:
|
|||
|
||||
colors:
|
||||
default_human_name: (a new color)
|
||||
prank_suffix: (fake)
|
||||
|
||||
contributions:
|
||||
contributed_description:
|
||||
|
|
5
db/migrate/20240928022359_remove_prank_from_colors.rb
Normal file
5
db/migrate/20240928022359_remove_prank_from_colors.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class RemovePrankFromColors < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
remove_column "colors", "prank", :boolean, default: false, null: false
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_04_08_120359) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_04_08_120359) do
|
||||
create_table "users", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_general_ci", force: :cascade do |t|
|
||||
t.string "name", limit: 30, null: false
|
||||
t.string "encrypted_password", limit: 64
|
||||
|
@ -37,5 +37,4 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_08_120359) do
|
|||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_06_16_001002) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_09_28_022359) do
|
||||
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
||||
t.integer "species_id", null: false
|
||||
t.integer "color_id", null: false
|
||||
|
@ -75,7 +75,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_06_16_001002) do
|
|||
create_table "colors", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
|
||||
t.boolean "basic"
|
||||
t.boolean "standard"
|
||||
t.boolean "prank", default: false, null: false
|
||||
t.string "name", null: false
|
||||
t.string "pb_item_name"
|
||||
t.string "pb_item_thumbnail_url"
|
||||
|
|
Loading…
Reference in a new issue