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

Merge pull request #2817 from pixelfed/staging

Staging
daniel пре 4 година
родитељ
комит
d2ff41db05
2 измењених фајлова са 14 додато и 1 уклоњено
  1. 9 1
      app/Services/LikeService.php
  2. 5 0
      app/Util/ActivityPub/Inbox.php

+ 9 - 1
app/Services/LikeService.php

@@ -62,8 +62,16 @@ class LikeService {
 		if(!$status->likes_count) {
 			return $empty;
 		}
+		$user = request()->user();
 
-		$like = Like::whereStatusId($status->id)->first();
+		if($user) {
+			$like = Like::whereStatusId($status->id)
+			->where('profile_id', '!=', $user->profile_id)
+			->first();
+		} else {
+			$like = Like::whereStatusId($status->id)
+			->first();
+		}
 
 		if(!$like) {
 			return $empty;

+ 5 - 0
app/Util/ActivityPub/Inbox.php

@@ -435,9 +435,14 @@ class Inbox
 		if(!$actor || !$target) {
 			return;
 		}
+
 		$actor = Helpers::profileFetch($actor);
 		$target = Helpers::profileFetch($target);
 
+		if(!$actor || !$target) {
+			return;
+		}
+
 		$request = FollowRequest::whereFollowerId($actor->id)
 			->whereFollowingId($target->id)
 			->whereIsRejected(false)