diff options
Diffstat (limited to 'app/serializers/rest')
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/application_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/media_attachment_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/notification_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/relationship_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/report_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 14 |
7 files changed, 38 insertions, 2 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 012a4fd18..65fdb0308 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -7,6 +7,10 @@ class REST::AccountSerializer < ActiveModel::Serializer :note, :url, :avatar, :avatar_static, :header, :header_static, :followers_count, :following_count, :statuses_count + def id + object.id.to_s + end + def note Formatter.instance.simplified_format(object) end diff --git a/app/serializers/rest/application_serializer.rb b/app/serializers/rest/application_serializer.rb index 868a62f1e..5eb03a513 100644 --- a/app/serializers/rest/application_serializer.rb +++ b/app/serializers/rest/application_serializer.rb @@ -4,8 +4,12 @@ class REST::ApplicationSerializer < ActiveModel::Serializer attributes :id, :name, :website, :redirect_uri, :client_id, :client_secret + def id + object.id.to_s + end + def client_id - object.uid + object.uid.to_s end def client_secret diff --git a/app/serializers/rest/media_attachment_serializer.rb b/app/serializers/rest/media_attachment_serializer.rb index 31189406a..f6e7c79d1 100644 --- a/app/serializers/rest/media_attachment_serializer.rb +++ b/app/serializers/rest/media_attachment_serializer.rb @@ -6,6 +6,10 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer attributes :id, :type, :url, :preview_url, :remote_url, :text_url, :meta + def id + object.id.to_s + end + def url if object.needs_redownload? media_proxy_url(object.id, :original) diff --git a/app/serializers/rest/notification_serializer.rb b/app/serializers/rest/notification_serializer.rb index f95d099a3..541a6b8b5 100644 --- a/app/serializers/rest/notification_serializer.rb +++ b/app/serializers/rest/notification_serializer.rb @@ -6,6 +6,10 @@ class REST::NotificationSerializer < ActiveModel::Serializer belongs_to :from_account, key: :account, serializer: REST::AccountSerializer belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer + def id + object.id.to_s + end + def status_type? [:favourite, :reblog, :mention].include?(object.type) end diff --git a/app/serializers/rest/relationship_serializer.rb b/app/serializers/rest/relationship_serializer.rb index 1d431aa1b..998727e37 100644 --- a/app/serializers/rest/relationship_serializer.rb +++ b/app/serializers/rest/relationship_serializer.rb @@ -4,6 +4,10 @@ class REST::RelationshipSerializer < ActiveModel::Serializer attributes :id, :following, :followed_by, :blocking, :muting, :requested, :domain_blocking + def id + object.id.to_s + end + def following instance_options[:relationships].following[object.id] || false end diff --git a/app/serializers/rest/report_serializer.rb b/app/serializers/rest/report_serializer.rb index 0c6bd6556..ecb88d653 100644 --- a/app/serializers/rest/report_serializer.rb +++ b/app/serializers/rest/report_serializer.rb @@ -2,4 +2,8 @@ class REST::ReportSerializer < ActiveModel::Serializer attributes :id, :action_taken + + def id + object.id.to_s + end end diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 066d65d9e..e0fd1c77e 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -19,6 +19,18 @@ class REST::StatusSerializer < ActiveModel::Serializer has_many :tags has_many :emojis + def id + object.id.to_s + end + + def in_reply_to_id + object.in_reply_to_id.to_s + end + + def in_reply_to_account_id + object.in_reply_to_account_id.to_s + end + def current_user? !current_user.nil? end @@ -82,7 +94,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attributes :id, :username, :url, :acct def id - object.account_id + object.account_id.to_s end def username |