about summary refs log tree commit diff
path: root/app/api/mastodon/entities.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/api/mastodon/entities.rb')
-rw-r--r--app/api/mastodon/entities.rb31
1 files changed, 29 insertions, 2 deletions
diff --git a/app/api/mastodon/entities.rb b/app/api/mastodon/entities.rb
index 2e56a67df..975e72538 100644
--- a/app/api/mastodon/entities.rb
+++ b/app/api/mastodon/entities.rb
@@ -1,17 +1,44 @@
 module Mastodon
   module Entities
     class Account < Grape::Entity
+      include ApplicationHelper
+
+      expose :id
       expose :username
-      expose :domain
+
+      expose :domain do |account|
+        account.local? ? LOCAL_DOMAIN : account.domain
+      end
+
       expose :display_name
       expose :note
+
+      expose :url do |account|
+        account.local? ? profile_url(name: account.username) : account.url
+      end
     end
 
     class Status < Grape::Entity
+      include ApplicationHelper
+
       format_with(:iso_timestamp) { |dt| dt.iso8601 }
 
-      expose :uri
+      expose :id
+
+      expose :uri do |status|
+        status.local? ? unique_tag(status.stream_entry.created_at, status.stream_entry.activity_id, status.stream_entry.activity_type) : status.uri
+      end
+
+      expose :url do |status|
+        status.local? ? status_url(name: status.account.username, id: status.id) : status.url
+      end
+
       expose :text
+      expose :in_reply_to_id
+
+      expose :reblog_of_id
+      expose :reblog, using: Mastodon::Entities::Status
+
       expose :account, using: Mastodon::Entities::Account
 
       with_options(format_with: :iso_timestamp) do