about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-06-12 13:17:21 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-06-12 13:17:21 +0000
commit4d8d1fa129b5f8692311de211203bc18c614951f (patch)
treee9a1130c9a9e5a5b8babd2ba3153e4ed03a4581e /app/controllers
parent34f1fd2a621ca869c17009487e2f10063812fbd0 (diff)
parent6151308c47efb0e05bcb2c54aa1693f5ff04da5c (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v1/domain_blocks_controller.rb3
-rw-r--r--app/controllers/intents_controller.rb19
-rw-r--r--app/controllers/settings/follower_domains_controller.rb2
3 files changed, 20 insertions, 4 deletions
diff --git a/app/controllers/api/v1/domain_blocks_controller.rb b/app/controllers/api/v1/domain_blocks_controller.rb
index ae6ad7936..e55d622c3 100644
--- a/app/controllers/api/v1/domain_blocks_controller.rb
+++ b/app/controllers/api/v1/domain_blocks_controller.rb
@@ -15,7 +15,8 @@ class Api::V1::DomainBlocksController < Api::BaseController
   end
 
   def create
-    BlockDomainFromAccountService.new.call(current_account, domain_block_params[:domain])
+    current_account.block_domain!(domain_block_params[:domain])
+    AfterAccountDomainBlockWorker.perform_async(current_account.id, domain_block_params[:domain])
     render_empty
   end
 
diff --git a/app/controllers/intents_controller.rb b/app/controllers/intents_controller.rb
index 504befd1f..56129d69a 100644
--- a/app/controllers/intents_controller.rb
+++ b/app/controllers/intents_controller.rb
@@ -1,9 +1,10 @@
 # frozen_string_literal: true
 
 class IntentsController < ApplicationController
-  def show
-    uri = Addressable::URI.parse(params[:uri])
+  before_action :check_uri
+  rescue_from Addressable::URI::InvalidURIError, with: :handle_invalid_uri
 
+  def show
     if uri.scheme == 'web+mastodon'
       case uri.host
       when 'follow'
@@ -15,4 +16,18 @@ class IntentsController < ApplicationController
 
     not_found
   end
+
+  private
+
+  def check_uri
+    not_found if uri.blank?
+  end
+
+  def handle_invalid_uri
+    not_found
+  end
+
+  def uri
+    @uri ||= Addressable::URI.parse(params[:uri])
+  end
 end
diff --git a/app/controllers/settings/follower_domains_controller.rb b/app/controllers/settings/follower_domains_controller.rb
index 02533b81a..83945df52 100644
--- a/app/controllers/settings/follower_domains_controller.rb
+++ b/app/controllers/settings/follower_domains_controller.rb
@@ -11,7 +11,7 @@ class Settings::FollowerDomainsController < Settings::BaseController
   def update
     domains = bulk_params[:select] || []
 
-    SoftBlockDomainFollowersWorker.push_bulk(domains) do |domain|
+    AfterAccountDomainBlockWorker.push_bulk(domains) do |domain|
       [current_account.id, domain]
     end