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

Conflicts:
- Gemfile.lock
- app/controllers/accounts_controller.rb
- app/controllers/admin/dashboard_controller.rb
- app/controllers/follower_accounts_controller.rb
- app/controllers/following_accounts_controller.rb
- app/controllers/remote_follow_controller.rb
- app/controllers/stream_entries_controller.rb
- app/controllers/tags_controller.rb
- app/javascript/packs/public.js
- app/lib/sanitize_config.rb
- app/models/account.rb
- app/models/form/admin_settings.rb
- app/models/media_attachment.rb
- app/models/stream_entry.rb
- app/models/user.rb
- app/serializers/initial_state_serializer.rb
- app/services/batched_remove_status_service.rb
- app/services/post_status_service.rb
- app/services/process_mentions_service.rb
- app/services/reblog_service.rb
- app/services/remove_status_service.rb
- app/views/admin/settings/edit.html.haml
- config/locales/simple_form.pl.yml
- config/settings.yml
- docker-compose.yml
This commit is contained in:
Thibaut Girka
2019-07-19 18:26:49 +02:00
411 changed files with 3416 additions and 8150 deletions

View File

@@ -4,6 +4,7 @@ class ActivityPub::ActivitySerializer < ActivityPub::Serializer
attributes :id, :type, :actor, :published, :to, :cc
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, if: :serialize_object?
attribute :proper_uri, key: :object, unless: :serialize_object?
attribute :atom_uri, if: :announce?

View File

@@ -39,11 +39,17 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
delegate :moved?, to: :object
def id
account_url(object)
object.instance_actor? ? instance_actor_url : account_url(object)
end
def type
object.bot? ? 'Service' : 'Person'
if object.instance_actor?
'Application'
elsif object.bot?
'Service'
else
'Person'
end
end
def following
@@ -55,7 +61,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
end
def inbox
account_inbox_url(object)
object.instance_actor? ? instance_actor_inbox_url : account_inbox_url(object)
end
def outbox
@@ -95,7 +101,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
end
def url
short_account_url(object)
object.instance_actor? ? about_more_url(instance_actor: true) : short_account_url(object)
end
def avatar_exists?

View File

@@ -29,7 +29,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
end
def url
TagManager.instance.url_for(object)
ActivityPub::TagManager.instance.url_for(object)
end
def avatar

View File

@@ -61,7 +61,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
end
def uri
OStatus::TagManager.instance.uri_for(object)
ActivityPub::TagManager.instance.uri_for(object)
end
def content
@@ -69,7 +69,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
end
def url
TagManager.instance.url_for(object)
ActivityPub::TagManager.instance.url_for(object)
end
def favourited
@@ -143,7 +143,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
end
def url
TagManager.instance.url_for(object.account)
ActivityPub::TagManager.instance.url_for(object.account)
end
def acct

View File

@@ -2,7 +2,7 @@
class RSS::AccountSerializer
include ActionView::Helpers::NumberHelper
include StreamEntriesHelper
include StatusesHelper
include RoutingHelper
def render(account, statuses)
@@ -10,7 +10,7 @@ class RSS::AccountSerializer
builder.title("#{display_name(account)} (@#{account.local_username_and_domain})")
.description(account_description(account))
.link(TagManager.instance.url_for(account))
.link(ActivityPub::TagManager.instance.url_for(account))
.logo(full_pack_url('media/images/logo.svg'))
.accent_color('2b90d9')
@@ -20,7 +20,7 @@ class RSS::AccountSerializer
statuses.each do |status|
builder.item do |item|
item.title(status.title)
.link(TagManager.instance.url_for(status))
.link(ActivityPub::TagManager.instance.url_for(status))
.pub_date(status.created_at)
.description(status.spoiler_text.presence || Formatter.instance.format(status, inline_poll_options: true).to_str)

View File

@@ -3,7 +3,7 @@
class RSS::TagSerializer
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::SanitizeHelper
include StreamEntriesHelper
include StatusesHelper
include RoutingHelper
def render(tag, statuses)
@@ -18,7 +18,7 @@ class RSS::TagSerializer
statuses.each do |status|
builder.item do |item|
item.title(status.title)
.link(TagManager.instance.url_for(status))
.link(ActivityPub::TagManager.instance.url_for(status))
.pub_date(status.created_at)
.description(status.spoiler_text.presence || Formatter.instance.format(status).to_str)

View File

@@ -10,17 +10,26 @@ class WebfingerSerializer < ActiveModel::Serializer
end
def aliases
[short_account_url(object), account_url(object)]
if object.instance_actor?
[instance_actor_url]
else
[short_account_url(object), account_url(object)]
end
end
def links
[
{ rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: short_account_url(object) },
{ rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(object, format: 'atom') },
{ rel: 'self', type: 'application/activity+json', href: account_url(object) },
{ rel: 'salmon', href: api_salmon_url(object.id) },
{ rel: 'magic-public-key', href: "data:application/magic-public-key,#{object.magic_key}" },
{ rel: 'http://ostatus.org/schema/1.0/subscribe', template: "#{authorize_interaction_url}?uri={uri}" },
]
if object.instance_actor?
[
{ rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: about_more_url(instance_actor: true) },
{ rel: 'self', type: 'application/activity+json', href: instance_actor_url },
]
else
[
{ rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: short_account_url(object) },
{ rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(object, format: 'atom') },
{ rel: 'self', type: 'application/activity+json', href: account_url(object) },
{ rel: 'http://ostatus.org/schema/1.0/subscribe', template: "#{authorize_interaction_url}?uri={uri}" },
]
end
end
end