Return character limit in API and initial state.
parent
666540f4a8
commit
a45f3cdc69
|
@ -2,10 +2,15 @@
|
||||||
|
|
||||||
class InitialStateSerializer < ActiveModel::Serializer
|
class InitialStateSerializer < ActiveModel::Serializer
|
||||||
attributes :meta, :compose, :accounts,
|
attributes :meta, :compose, :accounts,
|
||||||
:media_attachments, :settings, :push_subscription
|
:media_attachments, :settings, :push_subscription,
|
||||||
|
:max_chars
|
||||||
|
|
||||||
has_many :custom_emojis, serializer: REST::CustomEmojiSerializer
|
has_many :custom_emojis, serializer: REST::CustomEmojiSerializer
|
||||||
|
|
||||||
|
def max_chars
|
||||||
|
StatusLengthValidator::MAX_CHARS
|
||||||
|
end
|
||||||
|
|
||||||
def custom_emojis
|
def custom_emojis
|
||||||
CustomEmoji.local.where(disabled: false)
|
CustomEmoji.local.where(disabled: false)
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
|
|
||||||
attributes :uri, :title, :description, :email,
|
attributes :uri, :title, :description, :email,
|
||||||
:version, :urls, :stats, :thumbnail
|
:version, :urls, :stats, :thumbnail, :max_chars
|
||||||
|
|
||||||
def uri
|
def uri
|
||||||
Rails.configuration.x.local_domain
|
Rails.configuration.x.local_domain
|
||||||
|
@ -30,6 +30,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
full_asset_url(instance_presenter.thumbnail.file.url) if instance_presenter.thumbnail
|
full_asset_url(instance_presenter.thumbnail.file.url) if instance_presenter.thumbnail
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def max_chars
|
||||||
|
StatusLengthValidator::MAX_CHARS
|
||||||
|
end
|
||||||
|
|
||||||
def stats
|
def stats
|
||||||
{
|
{
|
||||||
user_count: instance_presenter.user_count,
|
user_count: instance_presenter.user_count,
|
||||||
|
|
Loading…
Reference in New Issue