Merge remote-tracking branch 'origin/master' into merge-upstream

Conflicts:
 	README.md
 	app/controllers/follower_accounts_controller.rb
 	app/controllers/following_accounts_controller.rb
 	app/serializers/rest/instance_serializer.rb
 	app/views/stream_entries/_simple_status.html.haml
 	config/locales/simple_form.ja.yml
This commit is contained in:
David Yip
2018-03-02 21:46:44 -06:00
158 changed files with 3365 additions and 1411 deletions

View File

@@ -0,0 +1,27 @@
# frozen_string_literal: true
class ActivityPub::FlagSerializer < ActiveModel::Serializer
attributes :id, :type, :actor, :content
attribute :virtual_object, key: :object
def id
# This is nil for now
ActivityPub::TagManager.instance.uri_for(object)
end
def type
'Flag'
end
def actor
ActivityPub::TagManager.instance.uri_for(instance_options[:account] || object.account)
end
def virtual_object
[ActivityPub::TagManager.instance.uri_for(object.target_account)] + object.statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
end
def content
object.comment
end
end

View File

@@ -22,6 +22,7 @@ class InitialStateSerializer < ActiveModel::Serializer
locale: I18n.locale,
domain: Rails.configuration.x.local_domain,
admin: object.admin&.id&.to_s,
search_enabled: Chewy.enabled?,
}
if object.current_account

View File

@@ -4,7 +4,12 @@ class REST::InstanceSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :uri, :title, :description, :email,
:version, :urls, :stats, :thumbnail, :max_toot_chars
:version, :urls, :stats, :thumbnail, :max_toot_chars,
:languages
has_one :contact_account, serializer: REST::AccountSerializer
delegate :contact_account, to: :instance_presenter
def uri
Rails.configuration.x.local_domain
@@ -46,6 +51,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
{ streaming_api: Rails.configuration.x.streaming_api_base_url }
end
def languages
[ENV.fetch('DEFAULT_LOCALE', I18n.default_locale)]
end
private
def instance_presenter