Parcourir la source

Need to disable caching again due to bug in Rabl

master
Eugen Rochko il y a 7 ans
Parent
révision
562044f36a
5 fichiers modifiés avec 12 ajouts et 15 suppressions
  1. +3
    -4
      app/controllers/api/v1/statuses_controller.rb
  2. +1
    -0
      app/views/api/v1/accounts/relationship.rabl
  3. +1
    -1
      app/views/api/v1/accounts/show.rabl
  4. +6
    -9
      app/views/api/v1/statuses/context.rabl
  5. +1
    -1
      app/views/api/v1/statuses/show.rabl

+ 3
- 4
app/controllers/api/v1/statuses_controller.rb Voir le fichier

@@ -9,10 +9,9 @@ class Api::V1::StatusesController < ApiController
end

def context
@status = Status.find(params[:id])
@ancestors = @status.ancestors
@descendants = @status.descendants
set_maps([@status] + @ancestors + @descendants)
@status = Status.find(params[:id])
@context = OpenStruct.new({ ancestors: @status.ancestors, descendants: @status.descendants })
set_maps([@status] + @context[:ancestors] + @context[:descendants])
end

def create


+ 1
- 0
app/views/api/v1/accounts/relationship.rabl Voir le fichier

@@ -1,4 +1,5 @@
object @account
cache false
attribute :id
node(:following) { |account| @following[account.id] || false }
node(:followed_by) { |account| @followed_by[account.id] || false }


+ 1
- 1
app/views/api/v1/accounts/show.rabl Voir le fichier

@@ -1,5 +1,5 @@
object @account
cache @account
cache false

attributes :id, :username, :acct, :display_name, :note



+ 6
- 9
app/views/api/v1/statuses/context.rabl Voir le fichier

@@ -1,13 +1,10 @@
object false
object @context
cache false

node :ancestors do
@ancestors.map do |status|
partial('api/v1/statuses/show', object: status)
end
node :ancestors do |context|
partial 'api/v1/statuses/index', object: context.ancestors
end

node :descendants do
@descendants.map do |status|
partial('api/v1/statuses/show', object: status)
end
node :descendants do |context|
partial 'api/v1/statuses/index', object: context.descendants
end

+ 1
- 1
app/views/api/v1/statuses/show.rabl Voir le fichier

@@ -1,5 +1,5 @@
object @status
cache @status
cache false

extends 'api/v1/statuses/_show'



Chargement…
Annuler
Enregistrer