diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-12-15 10:38:54 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-12-15 10:45:53 +0100 |
commit | 65e994b29b7c3b06dc61ab5eed35b571ebafdf94 (patch) | |
tree | 4cb922f9abb201278312210d678f43ab976b6aea /app/services | |
parent | f0505a5b2e727da73c8aa651b804508a8187a3c4 (diff) | |
parent | 67b924e324220885b46d9e26c8beb6ee8d3cf8bf (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/directories_controller.rb - app/controllers/settings/applications_controller.rb - app/controllers/settings/base_controller.rb - app/controllers/settings/deletes_controller.rb - app/controllers/settings/exports_controller.rb - app/controllers/settings/follower_domains_controller.rb - app/controllers/settings/imports_controller.rb - app/controllers/settings/migrations_controller.rb - app/controllers/settings/notifications_controller.rb - app/controllers/settings/preferences_controller.rb - app/controllers/settings/sessions_controller.rb - app/controllers/settings/two_factor_authentication/confirmations_controller.rb - app/controllers/settings/two_factor_authentication/recovery_codes_controller.rb - app/controllers/settings/two_factor_authentications_controller.rb Conflicts were due to some refactoring already made in glitch-soc when introducing flavours.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/pubsubhubbub/subscribe_service.rb | 28 | ||||
-rw-r--r-- | app/services/update_account_service.rb | 3 |
2 files changed, 8 insertions, 23 deletions
diff --git a/app/services/pubsubhubbub/subscribe_service.rb b/app/services/pubsubhubbub/subscribe_service.rb index 2dba05b12..550da6328 100644 --- a/app/services/pubsubhubbub/subscribe_service.rb +++ b/app/services/pubsubhubbub/subscribe_service.rb @@ -19,31 +19,18 @@ class Pubsubhubbub::SubscribeService < BaseService private def process_subscribe - case subscribe_status - when :invalid_topic + if account.nil? ['Invalid topic URL', 422] - when :invalid_callback + elsif !valid_callback? ['Invalid callback URL', 422] - when :callback_not_allowed + elsif blocked_domain? ['Callback URL not allowed', 403] - when :valid + else confirm_subscription ['', 202] end end - def subscribe_status - if account.nil? - :invalid_topic - elsif !valid_callback? - :invalid_callback - elsif blocked_domain? - :callback_not_allowed - else - :valid - end - end - def confirm_subscription subscription = locate_subscription Pubsubhubbub::ConfirmationWorker.perform_async(subscription.id, 'subscribe', secret, lease_seconds) @@ -58,12 +45,7 @@ class Pubsubhubbub::SubscribeService < BaseService end def locate_subscription - subscription = Subscription.find_by(account: account, callback_url: callback) - - if subscription.nil? - subscription = Subscription.new(account: account, callback_url: callback) - end - + subscription = Subscription.find_or_initialize_by(account: account, callback_url: callback) subscription.domain = domain subscription.save! subscription diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index 36665177d..01756a73d 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -12,6 +12,9 @@ class UpdateAccountService < BaseService check_links(account) process_hashtags(account) end + rescue Mastodon::DimensionsValidationError => de + account.errors.add(:avatar, de.message) + false end private |