Disable loading alt style pets specifically
This commit is contained in:
parent
1057fdd3a9
commit
0406a32444
2 changed files with 19 additions and 5 deletions
|
@ -1,7 +1,8 @@
|
|||
class PetsController < ApplicationController
|
||||
rescue_from Pet::PetNotFound, :with => :pet_not_found
|
||||
rescue_from PetType::DownloadError, SwfAsset::DownloadError, :with => :asset_download_error
|
||||
rescue_from Pet::DownloadError, :with => :pet_download_error
|
||||
rescue_from Pet::PetNotFound, with: :pet_not_found
|
||||
rescue_from PetType::DownloadError, SwfAsset::DownloadError, with: :asset_download_error
|
||||
rescue_from Pet::DownloadError, with: :pet_download_error
|
||||
rescue_from Pet::AltStyleNotSupportedYet, with: :alt_style_not_supported_yet
|
||||
|
||||
def load
|
||||
return modeling_disabled unless user_signed_in? && current_user.admin?
|
||||
|
@ -81,4 +82,12 @@ class PetsController < ApplicationController
|
|||
pet_load_error long_message: t('pets.load.modeling_disabled'),
|
||||
status: :forbidden
|
||||
end
|
||||
|
||||
def alt_style_not_supported_yet
|
||||
pet_load_error(
|
||||
long_message: "This pet is using the new Alt Styles feature, which " +
|
||||
"we're still working on. Thank you for trying, we'll be ready soon!!",
|
||||
status: :bad_request,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,6 +33,10 @@ class Pet < ApplicationRecord
|
|||
|
||||
pet_data = viewer_data[:custom_pet]
|
||||
|
||||
if pet_data[:alt_style]
|
||||
raise AltStyleNotSupportedYet
|
||||
end
|
||||
|
||||
self.pet_type = PetType.find_or_initialize_by(
|
||||
species_id: pet_data[:species_id].to_i,
|
||||
color_id: pet_data[:color_id].to_i
|
||||
|
@ -117,7 +121,8 @@ class Pet < ApplicationRecord
|
|||
HashWithIndifferentAccess.new(envelope.messages[0].data.body)
|
||||
end
|
||||
|
||||
class PetNotFound < Exception;end
|
||||
class DownloadError < Exception;end
|
||||
class PetNotFound < RuntimeError;end
|
||||
class DownloadError < RuntimeError;end
|
||||
class AltStyleNotSupportedYet < RuntimeError;end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue