Преглед изворни кода

Merge pull request #995 from pixelfed/frontend-ui-refactor

Update AP Note transformers to return media attachments in proper order
daniel пре 6 година
родитељ
комит
917010e2e5

+ 1 - 1
app/Transformer/ActivityPub/Verb/CreateNote.php

@@ -49,7 +49,7 @@ class CreateNote extends Fractal\TransformerAbstract
 				'to'           		=> $status->scopeToAudience('to'),
 				'cc' 				=> $status->scopeToAudience('cc'),
 				'sensitive'       	=> (bool) $status->is_nsfw,
-				'attachment'      	=> $status->media->map(function ($media) {
+				'attachment'      	=> $status->media()->orderBy('order')->get()->map(function ($media) {
 					return [
 						'type'      => $media->activityVerb(),
 						'mediaType' => $media->mime,

+ 1 - 1
app/Transformer/ActivityPub/Verb/Note.php

@@ -42,7 +42,7 @@ class Note extends Fractal\TransformerAbstract
 			'to'           		=> $status->scopeToAudience('to'),
 			'cc' 				=> $status->scopeToAudience('cc'),
 			'sensitive'       	=> (bool) $status->is_nsfw,
-			'attachment'      	=> $status->media->map(function ($media) {
+			'attachment'      	=> $status->media()->orderBy('order')->get()->map(function ($media) {
 				return [
 					'type'      => $media->activityVerb(),
 					'mediaType' => $media->mime,