about summary refs log tree commit diff
path: root/app/views/api
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-07-07 04:02:06 +0200
committerGitHub <noreply@github.com>2017-07-07 04:02:06 +0200
commit8b2cad56374b2dbb6e7a445e7917810935c45536 (patch)
treebebba9b1e98d599b3caa249a8d98fad0cfd70437 /app/views/api
parent2d6128672fcadeb29c99551a33648b4880969d22 (diff)
Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090)
Diffstat (limited to 'app/views/api')
-rw-r--r--app/views/api/v1/accounts/index.rabl2
-rw-r--r--app/views/api/v1/accounts/relationship.rabl9
-rw-r--r--app/views/api/v1/accounts/relationships/index.rabl2
-rw-r--r--app/views/api/v1/accounts/show.rabl12
-rw-r--r--app/views/api/v1/accounts/statuses/index.rabl2
-rw-r--r--app/views/api/v1/apps/create.rabl4
-rw-r--r--app/views/api/v1/apps/show.rabl3
-rw-r--r--app/views/api/v1/blocks/index.rabl2
-rw-r--r--app/views/api/v1/favourites/index.rabl2
-rw-r--r--app/views/api/v1/follow_requests/index.rabl2
-rw-r--r--app/views/api/v1/follows/show.rabl2
-rw-r--r--app/views/api/v1/instances/show.rabl10
-rw-r--r--app/views/api/v1/media/create.rabl7
-rw-r--r--app/views/api/v1/mutes/index.rabl2
-rw-r--r--app/views/api/v1/notifications/index.rabl2
-rw-r--r--app/views/api/v1/notifications/show.rabl11
-rw-r--r--app/views/api/v1/reports/index.rabl2
-rw-r--r--app/views/api/v1/reports/show.rabl2
-rw-r--r--app/views/api/v1/search/index.rabl13
-rw-r--r--app/views/api/v1/statuses/_media.rabl6
-rw-r--r--app/views/api/v1/statuses/_mention.rabl4
-rw-r--r--app/views/api/v1/statuses/_show.rabl29
-rw-r--r--app/views/api/v1/statuses/_tags.rabl2
-rw-r--r--app/views/api/v1/statuses/accounts.rabl2
-rw-r--r--app/views/api/v1/statuses/card.rabl7
-rw-r--r--app/views/api/v1/statuses/context.rabl9
-rw-r--r--app/views/api/v1/statuses/index.rabl2
-rw-r--r--app/views/api/v1/statuses/show.rabl15
-rw-r--r--app/views/api/v1/timelines/show.rabl2
29 files changed, 0 insertions, 169 deletions
diff --git a/app/views/api/v1/accounts/index.rabl b/app/views/api/v1/accounts/index.rabl
deleted file mode 100644
index 9f3b13a53..000000000
--- a/app/views/api/v1/accounts/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @accounts
-extends 'api/v1/accounts/show'
diff --git a/app/views/api/v1/accounts/relationship.rabl b/app/views/api/v1/accounts/relationship.rabl
deleted file mode 100644
index 4f7763d9d..000000000
--- a/app/views/api/v1/accounts/relationship.rabl
+++ /dev/null
@@ -1,9 +0,0 @@
-object @account
-
-attribute :id
-node(:following)       { |account| @following[account.id]       || false }
-node(:followed_by)     { |account| @followed_by[account.id]     || false }
-node(:blocking)        { |account| @blocking[account.id]        || false }
-node(:muting)          { |account| @muting[account.id]          || false }
-node(:requested)       { |account| @requested[account.id]       || false }
-node(:domain_blocking) { |account| @domain_blocking[account.id] || false }
diff --git a/app/views/api/v1/accounts/relationships/index.rabl b/app/views/api/v1/accounts/relationships/index.rabl
deleted file mode 100644
index 022ea2ac4..000000000
--- a/app/views/api/v1/accounts/relationships/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @accounts
-extends 'api/v1/accounts/relationship'
diff --git a/app/views/api/v1/accounts/show.rabl b/app/views/api/v1/accounts/show.rabl
deleted file mode 100644
index 8826aa22d..000000000
--- a/app/views/api/v1/accounts/show.rabl
+++ /dev/null
@@ -1,12 +0,0 @@
-object @account
-
-attributes :id, :username, :acct, :display_name, :locked, :created_at
-
-node(:note)            { |account| Formatter.instance.simplified_format(account) }
-node(:url)             { |account| TagManager.instance.url_for(account) }
-node(:avatar)          { |account| full_asset_url(account.avatar_original_url) }
-node(:avatar_static)   { |account| full_asset_url(account.avatar_static_url) }
-node(:header)          { |account| full_asset_url(account.header_original_url) }
-node(:header_static)   { |account| full_asset_url(account.header_static_url) }
-
-attributes :followers_count, :following_count, :statuses_count
diff --git a/app/views/api/v1/accounts/statuses/index.rabl b/app/views/api/v1/accounts/statuses/index.rabl
deleted file mode 100644
index 44d29d91b..000000000
--- a/app/views/api/v1/accounts/statuses/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @statuses
-extends 'api/v1/statuses/show'
diff --git a/app/views/api/v1/apps/create.rabl b/app/views/api/v1/apps/create.rabl
deleted file mode 100644
index 1ff6469a4..000000000
--- a/app/views/api/v1/apps/create.rabl
+++ /dev/null
@@ -1,4 +0,0 @@
-object @app
-attributes :id, :redirect_uri
-node(:client_id) { |app| app.uid }
-node(:client_secret) { |app| app.secret }
diff --git a/app/views/api/v1/apps/show.rabl b/app/views/api/v1/apps/show.rabl
deleted file mode 100644
index 6d9e607db..000000000
--- a/app/views/api/v1/apps/show.rabl
+++ /dev/null
@@ -1,3 +0,0 @@
-object @application
-
-attributes :name, :website
diff --git a/app/views/api/v1/blocks/index.rabl b/app/views/api/v1/blocks/index.rabl
deleted file mode 100644
index 9f3b13a53..000000000
--- a/app/views/api/v1/blocks/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @accounts
-extends 'api/v1/accounts/show'
diff --git a/app/views/api/v1/favourites/index.rabl b/app/views/api/v1/favourites/index.rabl
deleted file mode 100644
index 44d29d91b..000000000
--- a/app/views/api/v1/favourites/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @statuses
-extends 'api/v1/statuses/show'
diff --git a/app/views/api/v1/follow_requests/index.rabl b/app/views/api/v1/follow_requests/index.rabl
deleted file mode 100644
index 9f3b13a53..000000000
--- a/app/views/api/v1/follow_requests/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @accounts
-extends 'api/v1/accounts/show'
diff --git a/app/views/api/v1/follows/show.rabl b/app/views/api/v1/follows/show.rabl
deleted file mode 100644
index e07106164..000000000
--- a/app/views/api/v1/follows/show.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-object @account
-extends('api/v1/accounts/show')
diff --git a/app/views/api/v1/instances/show.rabl b/app/views/api/v1/instances/show.rabl
deleted file mode 100644
index 05fb65031..000000000
--- a/app/views/api/v1/instances/show.rabl
+++ /dev/null
@@ -1,10 +0,0 @@
-object false
-
-node(:uri)         { site_hostname }
-node(:title)       { Setting.site_title }
-node(:description) { Setting.site_description }
-node(:email)       { Setting.site_contact_email }
-node(:version)     { Mastodon::Version.to_s }
-node :urls do
-    { :streaming_api => Rails.configuration.x.streaming_api_base_url }
-end
diff --git a/app/views/api/v1/media/create.rabl b/app/views/api/v1/media/create.rabl
deleted file mode 100644
index 53c13bbda..000000000
--- a/app/views/api/v1/media/create.rabl
+++ /dev/null
@@ -1,7 +0,0 @@
-object @media
-attribute :id, :type
-
-node(:url)         { |media| full_asset_url(media.file.url(:original)) }
-node(:preview_url) { |media| full_asset_url(media.file.url(:small)) }
-node(:text_url)    { |media| medium_url(media) }
-node(:meta)        { |media| media.file.meta }
diff --git a/app/views/api/v1/mutes/index.rabl b/app/views/api/v1/mutes/index.rabl
deleted file mode 100644
index 9f3b13a53..000000000
--- a/app/views/api/v1/mutes/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @accounts
-extends 'api/v1/accounts/show'
diff --git a/app/views/api/v1/notifications/index.rabl b/app/views/api/v1/notifications/index.rabl
deleted file mode 100644
index 6abc3da36..000000000
--- a/app/views/api/v1/notifications/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @notifications
-extends 'api/v1/notifications/show'
diff --git a/app/views/api/v1/notifications/show.rabl b/app/views/api/v1/notifications/show.rabl
deleted file mode 100644
index ca34f2d5d..000000000
--- a/app/views/api/v1/notifications/show.rabl
+++ /dev/null
@@ -1,11 +0,0 @@
-object @notification
-
-attributes :id, :type, :created_at
-
-child from_account: :account do
-  extends 'api/v1/accounts/show'
-end
-
-node(:status, if: lambda { |n| [:favourite, :reblog, :mention].include?(n.type) }) do |n|
-  partial 'api/v1/statuses/show', object: n.target_status
-end
diff --git a/app/views/api/v1/reports/index.rabl b/app/views/api/v1/reports/index.rabl
deleted file mode 100644
index 4f0794027..000000000
--- a/app/views/api/v1/reports/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @reports
-extends 'api/v1/reports/show'
diff --git a/app/views/api/v1/reports/show.rabl b/app/views/api/v1/reports/show.rabl
deleted file mode 100644
index 006db51e3..000000000
--- a/app/views/api/v1/reports/show.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-object @report
-attributes :id, :action_taken
diff --git a/app/views/api/v1/search/index.rabl b/app/views/api/v1/search/index.rabl
deleted file mode 100644
index 8d1640f2d..000000000
--- a/app/views/api/v1/search/index.rabl
+++ /dev/null
@@ -1,13 +0,0 @@
-object @search
-
-child :accounts, object_root: false do
-  extends 'api/v1/accounts/show'
-end
-
-node(:hashtags) do |search|
-  search.hashtags.map(&:name)
-end
-
-child :statuses, object_root: false do
-  extends 'api/v1/statuses/show'
-end
diff --git a/app/views/api/v1/statuses/_media.rabl b/app/views/api/v1/statuses/_media.rabl
deleted file mode 100644
index 07ac31888..000000000
--- a/app/views/api/v1/statuses/_media.rabl
+++ /dev/null
@@ -1,6 +0,0 @@
-attributes :id, :remote_url, :type
-
-node(:url)         { |media| full_asset_url(media.file.url(:original)) }
-node(:preview_url) { |media| full_asset_url(media.file.url(:small)) }
-node(:text_url)    { |media| media.local? ? medium_url(media) : nil }
-node(:meta)        { |media| media.file.meta }
diff --git a/app/views/api/v1/statuses/_mention.rabl b/app/views/api/v1/statuses/_mention.rabl
deleted file mode 100644
index 8c95fc9bd..000000000
--- a/app/views/api/v1/statuses/_mention.rabl
+++ /dev/null
@@ -1,4 +0,0 @@
-node(:url)      { |mention| TagManager.instance.url_for(mention.account) }
-node(:acct)     { |mention| mention.account_acct }
-node(:id)       { |mention| mention.account_id }
-node(:username) { |mention| mention.account_username }
diff --git a/app/views/api/v1/statuses/_show.rabl b/app/views/api/v1/statuses/_show.rabl
deleted file mode 100644
index fe3ec89ab..000000000
--- a/app/views/api/v1/statuses/_show.rabl
+++ /dev/null
@@ -1,29 +0,0 @@
-attributes :id, :created_at, :in_reply_to_id,
-           :in_reply_to_account_id, :sensitive,
-           :spoiler_text, :visibility, :language
-
-node(:uri)              { |status| TagManager.instance.uri_for(status) }
-node(:content)          { |status| Formatter.instance.format(status) }
-node(:url)              { |status| TagManager.instance.url_for(status) }
-node(:reblogs_count)    { |status| defined?(@reblogs_counts_map)    ? (@reblogs_counts_map[status.id]    || 0) : status.reblogs_count }
-node(:favourites_count) { |status| defined?(@favourites_counts_map) ? (@favourites_counts_map[status.id] || 0) : status.favourites_count }
-
-child :application do
-  extends 'api/v1/apps/show'
-end
-
-child :account do
-  extends 'api/v1/accounts/show'
-end
-
-child :media_attachments, object_root: false do
-  extends 'api/v1/statuses/_media'
-end
-
-child :mentions, object_root: false do
-  extends 'api/v1/statuses/_mention'
-end
-
-child :tags, object_root: false do
-  extends 'api/v1/statuses/_tags'
-end
diff --git a/app/views/api/v1/statuses/_tags.rabl b/app/views/api/v1/statuses/_tags.rabl
deleted file mode 100644
index 25e7b0fac..000000000
--- a/app/views/api/v1/statuses/_tags.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-attribute :name
-node(:url) { |tag| tag_url(tag) }
diff --git a/app/views/api/v1/statuses/accounts.rabl b/app/views/api/v1/statuses/accounts.rabl
deleted file mode 100644
index 9f3b13a53..000000000
--- a/app/views/api/v1/statuses/accounts.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @accounts
-extends 'api/v1/accounts/show'
diff --git a/app/views/api/v1/statuses/card.rabl b/app/views/api/v1/statuses/card.rabl
deleted file mode 100644
index 5d8d7af3b..000000000
--- a/app/views/api/v1/statuses/card.rabl
+++ /dev/null
@@ -1,7 +0,0 @@
-object @card
-
-attributes :url, :title, :description, :type,
-           :author_name, :author_url, :provider_name,
-           :provider_url, :html, :width, :height
-
-node(:image) { |card| card.image? ? full_asset_url(card.image.url(:original)) : nil }
diff --git a/app/views/api/v1/statuses/context.rabl b/app/views/api/v1/statuses/context.rabl
deleted file mode 100644
index 0b62f26d5..000000000
--- a/app/views/api/v1/statuses/context.rabl
+++ /dev/null
@@ -1,9 +0,0 @@
-object @context
-
-node :ancestors do |context|
-  partial 'api/v1/statuses/index', object: context.ancestors
-end
-
-node :descendants do |context|
-  partial 'api/v1/statuses/index', object: context.descendants
-end
diff --git a/app/views/api/v1/statuses/index.rabl b/app/views/api/v1/statuses/index.rabl
deleted file mode 100644
index 0a0ed13c5..000000000
--- a/app/views/api/v1/statuses/index.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @statuses
-extends('api/v1/statuses/show')
diff --git a/app/views/api/v1/statuses/show.rabl b/app/views/api/v1/statuses/show.rabl
deleted file mode 100644
index 4b33fb2c3..000000000
--- a/app/views/api/v1/statuses/show.rabl
+++ /dev/null
@@ -1,15 +0,0 @@
-object @status
-
-extends 'api/v1/statuses/_show'
-
-node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? @favourites_map[status.id]         : current_account.favourited?(status) }
-node(:reblogged,  if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map)    ? @reblogs_map[status.id]            : current_account.reblogged?(status) }
-node(:muted,      if: proc { !current_account.nil? }) { |status| defined?(@mutes_map)      ? @mutes_map[status.conversation_id] : current_account.muting_conversation?(status.conversation) }
-
-child reblog: :reblog do
-  extends 'api/v1/statuses/_show'
-
-  node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? @favourites_map[status.id] : current_account.favourited?(status) }
-  node(:reblogged,  if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map)    ? @reblogs_map[status.id]    : current_account.reblogged?(status) }
-  node(:muted,      if: proc { !current_account.nil? }) { false }
-end
diff --git a/app/views/api/v1/timelines/show.rabl b/app/views/api/v1/timelines/show.rabl
deleted file mode 100644
index 0a0ed13c5..000000000
--- a/app/views/api/v1/timelines/show.rabl
+++ /dev/null
@@ -1,2 +0,0 @@
-collection @statuses
-extends('api/v1/statuses/show')