Merge tag 'v2.6.0rc1' into instance_only_statuses
This commit is contained in:
@ -68,7 +68,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
|
||||
end
|
||||
|
||||
def virtual_tags
|
||||
object.mentions.to_a.sort_by(&:id) + object.tags + object.emojis
|
||||
object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis
|
||||
end
|
||||
|
||||
def atom_uri
|
||||
|
@ -16,16 +16,18 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
search_enabled: Chewy.enabled?,
|
||||
version: Mastodon::Version.to_s,
|
||||
invites_enabled: Setting.min_invite_role == 'user',
|
||||
mascot: instance_presenter.mascot&.file&.url,
|
||||
}
|
||||
|
||||
if object.current_account
|
||||
store[:me] = object.current_account.id.to_s
|
||||
store[:unfollow_modal] = object.current_account.user.setting_unfollow_modal
|
||||
store[:boost_modal] = object.current_account.user.setting_boost_modal
|
||||
store[:delete_modal] = object.current_account.user.setting_delete_modal
|
||||
store[:auto_play_gif] = object.current_account.user.setting_auto_play_gif
|
||||
store[:display_sensitive_media] = object.current_account.user.setting_display_sensitive_media
|
||||
store[:reduce_motion] = object.current_account.user.setting_reduce_motion
|
||||
store[:me] = object.current_account.id.to_s
|
||||
store[:unfollow_modal] = object.current_account.user.setting_unfollow_modal
|
||||
store[:boost_modal] = object.current_account.user.setting_boost_modal
|
||||
store[:delete_modal] = object.current_account.user.setting_delete_modal
|
||||
store[:auto_play_gif] = object.current_account.user.setting_auto_play_gif
|
||||
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
|
||||
end
|
||||
|
||||
store
|
||||
@ -56,4 +58,10 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
def media_attachments
|
||||
{ accept_content_types: MediaAttachment::IMAGE_FILE_EXTENSIONS + MediaAttachment::VIDEO_FILE_EXTENSIONS + MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def instance_presenter
|
||||
@instance_presenter ||= InstancePresenter.new
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||
|
||||
class FieldSerializer < ActiveModel::Serializer
|
||||
attributes :name, :value
|
||||
attributes :name, :value, :verified_at
|
||||
|
||||
def value
|
||||
Formatter.instance.format_field(object.account, object.value)
|
||||
|
12
app/serializers/rest/conversation_serializer.rb
Normal file
12
app/serializers/rest/conversation_serializer.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::ConversationSerializer < ActiveModel::Serializer
|
||||
attributes :id, :unread
|
||||
|
||||
has_many :participant_accounts, key: :accounts, serializer: REST::AccountSerializer
|
||||
has_one :last_status, serializer: REST::StatusSerializer
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
end
|
@ -36,6 +36,17 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
!current_user.nil?
|
||||
end
|
||||
|
||||
def visibility
|
||||
# This visibility is masked behind "private"
|
||||
# to avoid API changes because there are no
|
||||
# UX differences
|
||||
if object.limited_visibility?
|
||||
'private'
|
||||
else
|
||||
object.visibility
|
||||
end
|
||||
end
|
||||
|
||||
def uri
|
||||
OStatus::TagManager.instance.uri_for(object)
|
||||
end
|
||||
@ -88,7 +99,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
end
|
||||
|
||||
def ordered_mentions
|
||||
object.mentions.to_a.sort_by(&:id)
|
||||
object.active_mentions.to_a.sort_by(&:id)
|
||||
end
|
||||
|
||||
class ApplicationSerializer < ActiveModel::Serializer
|
||||
|
Reference in New Issue
Block a user