mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update SharePipeline, fix ReblogService and undo handling
This commit is contained in:
parent
222dc3a192
commit
016c6e4144
3 changed files with 15 additions and 6 deletions
|
@ -63,7 +63,7 @@ class SharePipeline implements ShouldQueue
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReblogService::addPostReblog($parent->id, $status->id);
|
ReblogService::addPostReblog($parent->profile_id, $status->id);
|
||||||
|
|
||||||
$parent->reblogs_count = $parent->reblogs_count + 1;
|
$parent->reblogs_count = $parent->reblogs_count + 1;
|
||||||
$parent->save();
|
$parent->save();
|
||||||
|
|
|
@ -37,7 +37,7 @@ class UndoSharePipeline implements ShouldQueue
|
||||||
|
|
||||||
if($parent) {
|
if($parent) {
|
||||||
$target = $parent->profile_id;
|
$target = $parent->profile_id;
|
||||||
ReblogService::removePostReblog($parent->id, $status->id);
|
ReblogService::removePostReblog($parent->profile_id, $status->id);
|
||||||
|
|
||||||
if($parent->reblogs_count > 0) {
|
if($parent->reblogs_count > 0) {
|
||||||
$parent->reblogs_count = $parent->reblogs_count - 1;
|
$parent->reblogs_count = $parent->reblogs_count - 1;
|
||||||
|
|
|
@ -37,6 +37,7 @@ use App\Util\ActivityPub\Validator\UndoFollow as UndoFollowValidator;
|
||||||
|
|
||||||
use App\Services\PollService;
|
use App\Services\PollService;
|
||||||
use App\Services\FollowerService;
|
use App\Services\FollowerService;
|
||||||
|
use App\Services\ReblogService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Services\UserFilterService;
|
use App\Services\UserFilterService;
|
||||||
use App\Services\NetworkTimelineService;
|
use App\Services\NetworkTimelineService;
|
||||||
|
@ -602,6 +603,8 @@ class Inbox
|
||||||
$parent->reblogs_count = $parent->reblogs_count + 1;
|
$parent->reblogs_count = $parent->reblogs_count + 1;
|
||||||
$parent->save();
|
$parent->save();
|
||||||
|
|
||||||
|
ReblogService::addPostReblog($parent->profile_id, $status->id);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,17 +792,23 @@ class Inbox
|
||||||
if(is_array($obj) && isset($obj['object'])) {
|
if(is_array($obj) && isset($obj['object'])) {
|
||||||
$obj = $obj['object'];
|
$obj = $obj['object'];
|
||||||
}
|
}
|
||||||
if(!is_string($obj) || !Helpers::validateLocalUrl($obj)) {
|
if(!is_string($obj)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$status = Status::whereUri($obj)->exists();
|
if(Helpers::validateLocalUrl($obj)) {
|
||||||
|
$parsedId = last(explode('/', $obj));
|
||||||
|
$status = Status::find($parsedId);
|
||||||
|
} else {
|
||||||
|
$status = Status::whereUri($obj)->first();
|
||||||
|
}
|
||||||
if(!$status) {
|
if(!$status) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Status::whereProfileId($profile->id)
|
Status::whereProfileId($profile->id)
|
||||||
->whereReblogOfId($status->id)
|
->whereReblogOfId($status->id)
|
||||||
->forceDelete();
|
->delete();
|
||||||
Notification::whereProfileId($status->profile->id)
|
ReblogService::removePostReblog($profile->id, $status->id);
|
||||||
|
Notification::whereProfileId($status->profile_id)
|
||||||
->whereActorId($profile->id)
|
->whereActorId($profile->id)
|
||||||
->whereAction('share')
|
->whereAction('share')
|
||||||
->whereItemId($status->reblog_of_id)
|
->whereItemId($status->reblog_of_id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue