Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
- `app/controllers/activitypub/collections_controller.rb`:
  Conflict caused because we have additional code to make sure pinned
  local-only toots don't get rendered on the ActivityPub endpoints.
  Ported upstream changes.
This commit is contained in:
Thibaut Girka
2020-09-07 09:21:38 +02:00
18 changed files with 128 additions and 138 deletions

View File

@@ -10,7 +10,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
:discoverable, :olm
attributes :id, :type, :following, :followers,
:inbox, :outbox, :featured,
:inbox, :outbox, :featured, :featured_tags,
:preferred_username, :name, :summary,
:url, :manually_approves_followers,
:discoverable
@@ -74,13 +74,17 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
end
def outbox
account_outbox_url(object)
object.instance_actor? ? instance_actor_outbox_url : account_outbox_url(object)
end
def featured
account_collection_url(object, :featured)
end
def featured_tags
account_collection_url(object, :tags)
end
def endpoints
object
end

View File

@@ -16,6 +16,8 @@ class ActivityPub::CollectionSerializer < ActivityPub::Serializer
ActivityPub::NoteSerializer
when 'Device'
ActivityPub::DeviceSerializer
when 'FeaturedTag'
ActivityPub::HashtagSerializer
when 'ActivityPub::CollectionPresenter'
ActivityPub::CollectionSerializer
when 'String'

View File

@@ -0,0 +1,23 @@
# frozen_string_literal: true
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
include RoutingHelper
attributes :type, :href, :name
def type
'Hashtag'
end
def name
"##{object.name}"
end
def href
if object.class.name == 'FeaturedTag'
short_account_tag_url(object.account, object.tag)
else
tag_url(object)
end
end
end