소스 검색

Update Api Transformers, fixes #2234

Daniel Supernault 5 년 전
부모
커밋
6300789115
2개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      app/Transformer/Api/Mastodon/v1/NotificationTransformer.php
  2. 2 0
      app/Transformer/Api/Mastodon/v1/StatusTransformer.php

+ 2 - 2
app/Transformer/Api/Mastodon/v1/NotificationTransformer.php

@@ -37,10 +37,10 @@ class NotificationTransformer extends Fractal\TransformerAbstract
 			if($status) {
 				return $this->item($status, new StatusTransformer());
 			} else {
-				return null;
+				return $this->collection([], new StatusTransformer());
 			}
 		} else {
-			return null;
+			return $this->collection([], new StatusTransformer());
 		}
 	}
 

+ 2 - 0
app/Transformer/Api/Mastodon/v1/StatusTransformer.php

@@ -63,6 +63,8 @@ class StatusTransformer extends Fractal\TransformerAbstract
             if(in_array($status->type, ['photo', 'video', 'photo:album', 'loop', 'photo:video:album'])) {
                 $media = $status->media()->orderBy('order')->get();
                 return $this->collection($media, new MediaTransformer());
+            } else {
+                return $this->collection([], new MediaTransformer());
             }
         });
     }