Merge tag 'v2.7.0rc1' into instance_only_statuses

This commit is contained in:
Renato "Lond" Cerqueira
2019-01-09 10:47:10 +01:00
585 changed files with 16065 additions and 8146 deletions

View File

@ -14,6 +14,7 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
has_many :virtual_attachments, key: :attachment
attribute :moved_to, if: :moved?
attribute :also_known_as, if: :also_known_as?
class EndpointsSerializer < ActiveModel::Serializer
include RoutingHelper
@ -105,7 +106,7 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
end
def virtual_tags
object.emojis
object.emojis + object.tags
end
def virtual_attachments
@ -116,9 +117,31 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
ActivityPub::TagManager.instance.uri_for(object.moved_to_account)
end
def also_known_as?
!object.also_known_as.empty?
end
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
end
class TagSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :type, :href, :name
def type
'Hashtag'
end
def href
explore_hashtag_url(object)
end
def name
"##{object.name}"
end
end
class Account::FieldSerializer < ActiveModel::Serializer
attributes :type, :name, :value

View File

@ -17,6 +17,7 @@ class InitialStateSerializer < ActiveModel::Serializer
version: Mastodon::Version.to_s,
invites_enabled: Setting.min_invite_role == 'user',
mascot: instance_presenter.mascot&.file&.url,
profile_directory: Setting.profile_directory,
}
if object.current_account
@ -28,6 +29,7 @@ class InitialStateSerializer < ActiveModel::Serializer
store[:display_media] = object.current_account.user.setting_display_media
store[:expand_spoilers] = object.current_account.user.setting_expand_spoilers
store[:reduce_motion] = object.current_account.user.setting_reduce_motion
store[:is_staff] = object.current_account.user.staff?
end
store

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
class REST::ScheduledStatusSerializer < ActiveModel::Serializer
attributes :id, :scheduled_at, :params
has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
def id
object.id.to_s
end
def params
object.params.without(:application_id)
end
end