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

Conflicts:
	app/models/user.rb

Resolved by adding :default_language to user settings fields
This commit is contained in:
Thibaut Girka
2018-06-21 20:49:57 +02:00
129 changed files with 1169 additions and 576 deletions

View File

@ -1,12 +1,15 @@
# frozen_string_literal: true
class ActivityPub::NoteSerializer < ActiveModel::Serializer
attributes :id, :type, :summary, :content,
attributes :id, :type, :summary,
:in_reply_to, :published, :url,
:attributed_to, :to, :cc, :sensitive,
:atom_uri, :in_reply_to_atom_uri,
:conversation
attribute :content
attribute :content_map, if: :language?
has_many :media_attachments, key: :attachment
has_many :virtual_tags, key: :tag
@ -26,6 +29,14 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
Formatter.instance.format(object)
end
def content_map
{ object.language => Formatter.instance.format(object) }
end
def language?
object.language.present?
end
def in_reply_to
return unless object.reply? && !object.thread.nil?

View File

@ -25,7 +25,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
end
def note
Formatter.instance.simplified_format(object, custom_emojify: true)
Formatter.instance.simplified_format(object)
end
def url

View File

@ -9,6 +9,7 @@ class REST::CredentialAccountSerializer < REST::AccountSerializer
{
privacy: user.setting_default_privacy,
sensitive: user.setting_default_sensitive,
language: user.setting_default_language,
note: object.note,
fields: object.fields.map(&:to_h),
}