kopia lustrzana https://github.com/pixelfed/pixelfed
				
				
				
			Update StatusTransformer
							rodzic
							
								
									1f3a5e263b
								
							
						
					
					
						commit
						1c900a4ba4
					
				|  | @ -46,7 +46,8 @@ class StatusTransformer extends Fractal\TransformerAbstract | ||||||
|             'reply_count'               => (int) $status->reply_count, |             'reply_count'               => (int) $status->reply_count, | ||||||
|             'comments_disabled'         => $status->comments_disabled ? true : false, |             'comments_disabled'         => $status->comments_disabled ? true : false, | ||||||
|             'thread'                    => false, |             'thread'                    => false, | ||||||
|             'replies'                   => [] |             'replies'                   => [], | ||||||
|  |             'parent'                    => $status->parent() ? $this->transform($status->parent()) : [], | ||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -67,8 +68,10 @@ class StatusTransformer extends Fractal\TransformerAbstract | ||||||
|     public function includeMediaAttachments(Status $status) |     public function includeMediaAttachments(Status $status) | ||||||
|     { |     { | ||||||
|         return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) { |         return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) { | ||||||
|             $media = $status->media()->orderBy('order')->get(); |             if(in_array($status->type, ['photo', 'video'])) { | ||||||
|             return $this->collection($media, new MediaTransformer()); |                 $media = $status->media()->orderBy('order')->get(); | ||||||
|  |                 return $this->collection($media, new MediaTransformer()); | ||||||
|  |             } | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Daniel Supernault
						Daniel Supernault