about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-08-31 00:02:59 +0200
committerGitHub <noreply@github.com>2017-08-31 00:02:59 +0200
commit2db9ccaf3eeada3106e88e08163495ae8e741574 (patch)
tree010e0d0238762d0c439461193f30e92f32077599
parentcecf204bbbf9e5a296b4a6d28ffa1bbe27a741ed (diff)
Add sharedInbox to actors (#4737)
-rw-r--r--app/controllers/activitypub/inboxes_controller.rb2
-rw-r--r--app/serializers/activitypub/actor_serializer.rb9
-rw-r--r--config/routes.rb2
3 files changed, 10 insertions, 3 deletions
diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb
index 078494c20..5fce505fd 100644
--- a/app/controllers/activitypub/inboxes_controller.rb
+++ b/app/controllers/activitypub/inboxes_controller.rb
@@ -18,7 +18,7 @@ class ActivityPub::InboxesController < Api::BaseController
   private
 
   def set_account
-    @account = Account.find_local!(params[:account_username])
+    @account = Account.find_local!(params[:account_username]) if params[:account_username]
   end
 
   def body
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index b15736868..a72ecee24 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -4,8 +4,9 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
   include RoutingHelper
 
   attributes :id, :type, :following, :followers,
-             :inbox, :outbox, :preferred_username,
-             :name, :summary, :url
+             :inbox, :outbox, :shared_inbox,
+             :preferred_username, :name, :summary,
+             :url
 
   has_one :public_key, serializer: ActivityPub::PublicKeySerializer
 
@@ -52,6 +53,10 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
     account_outbox_url(object)
   end
 
+  def shared_inbox
+    inbox_url
+  end
+
   def preferred_username
     object.username
   end
diff --git a/config/routes.rb b/config/routes.rb
index f8f145e1d..7f7746068 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -56,6 +56,8 @@ Rails.application.routes.draw do
     resource :inbox, only: [:create], module: :activitypub
   end
 
+  resource :inbox, only: [:create], module: :activitypub
+
   get '/@:username', to: 'accounts#show', as: :short_account
   get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
   get '/@:username/media', to: 'accounts#show', as: :short_account_media