1
0
Fork 0

Merge pull request #3902 from pixelfed/staging

Update Inbox
This commit is contained in:
daniel 2022-12-05 01:42:33 -07:00 committed by GitHub
commit 35d856ba9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 15 deletions

View File

@ -202,7 +202,7 @@ class Inbox
if( is_array($to) && if( is_array($to) &&
is_array($cc) && is_array($cc) &&
count($to) == 1 && count($to) == 1 &&
count($cc) == 0 && count($cc) == 0 &&
parse_url($to[0], PHP_URL_HOST) == config('pixelfed.domain.app') parse_url($to[0], PHP_URL_HOST) == config('pixelfed.domain.app')
) { ) {
@ -219,6 +219,7 @@ class Inbox
} }
$this->handleNoteCreate(); $this->handleNoteCreate();
} }
return;
} }
public function handleNoteReply() public function handleNoteReply()
@ -481,10 +482,10 @@ class Inbox
return; return;
} }
$blocks = UserFilterService::blocks($target->id); $blocks = UserFilterService::blocks($target->id);
if($blocks && in_array($actor->id, $blocks)) { if($blocks && in_array($actor->id, $blocks)) {
return; return;
} }
if($target->is_private == true) { if($target->is_private == true) {
FollowRequest::updateOrCreate([ FollowRequest::updateOrCreate([
@ -522,6 +523,8 @@ class Inbox
Cache::forget('profile:following_count:'.$target->id); Cache::forget('profile:following_count:'.$target->id);
Cache::forget('profile:following_count:'.$actor->id); Cache::forget('profile:following_count:'.$actor->id);
} }
return;
} }
public function handleAnnounceActivity() public function handleAnnounceActivity()
@ -543,10 +546,10 @@ class Inbox
return; return;
} }
$blocks = UserFilterService::blocks($parent->profile_id); $blocks = UserFilterService::blocks($parent->profile_id);
if($blocks && in_array($actor->id, $blocks)) { if($blocks && in_array($actor->id, $blocks)) {
return; return;
} }
$status = Status::firstOrCreate([ $status = Status::firstOrCreate([
'profile_id' => $actor->id, 'profile_id' => $actor->id,
@ -564,8 +567,10 @@ class Inbox
'item_type' => 'App\Status' 'item_type' => 'App\Status'
]); ]);
$parent->reblogs_count = $parent->shares()->count(); $parent->reblogs_count = $parent->reblogs_count + 1;
$parent->save(); $parent->save();
return;
} }
public function handleAcceptActivity() public function handleAcceptActivity()
@ -608,6 +613,8 @@ class Inbox
FollowPipeline::dispatch($follower); FollowPipeline::dispatch($follower);
$request->delete(); $request->delete();
return;
} }
public function handleDeleteActivity() public function handleDeleteActivity()
@ -673,6 +680,7 @@ class Inbox
if($story) { if($story) {
StoryExpire::dispatch($story)->onQueue('story'); StoryExpire::dispatch($story)->onQueue('story');
} }
return;
break; break;
default: default:
@ -680,6 +688,7 @@ class Inbox
break; break;
} }
} }
return;
} }
public function handleLikeActivity() public function handleLikeActivity()
@ -700,10 +709,10 @@ class Inbox
return; return;
} }
$blocks = UserFilterService::blocks($status->profile_id); $blocks = UserFilterService::blocks($status->profile_id);
if($blocks && in_array($profile->id, $blocks)) { if($blocks && in_array($profile->id, $blocks)) {
return; return;
} }
$like = Like::firstOrCreate([ $like = Like::firstOrCreate([
'profile_id' => $profile->id, 'profile_id' => $profile->id,
@ -711,7 +720,7 @@ class Inbox
]); ]);
if($like->wasRecentlyCreated == true) { if($like->wasRecentlyCreated == true) {
$status->likes_count = $status->likes()->count(); $status->likes_count = $status->likes_count + 1;
$status->save(); $status->save();
LikePipeline::dispatch($like); LikePipeline::dispatch($like);
} }
@ -854,6 +863,8 @@ class Inbox
$story->view_count++; $story->view_count++;
$story->save(); $story->save();
} }
return;
} }
public function handleStoryReactionActivity() public function handleStoryReactionActivity()
@ -963,6 +974,8 @@ class Inbox
$n->message = "{$actorProfile->username} reacted to your story"; $n->message = "{$actorProfile->username} reacted to your story";
$n->rendered = "{$actorProfile->username} reacted to your story"; $n->rendered = "{$actorProfile->username} reacted to your story";
$n->save(); $n->save();
return;
} }
public function handleStoryReplyActivity() public function handleStoryReplyActivity()
@ -1072,5 +1085,7 @@ class Inbox
$n->message = "{$actorProfile->username} commented on story"; $n->message = "{$actorProfile->username} commented on story";
$n->rendered = "{$actorProfile->username} commented on story"; $n->rendered = "{$actorProfile->username} commented on story";
$n->save(); $n->save();
return;
} }
} }