mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update AP helpers, refactor post count decrement logic
This commit is contained in:
parent
ddf7f09ad4
commit
b81ae5773f
5 changed files with 9 additions and 13 deletions
|
@ -22,9 +22,9 @@ use App\Notification;
|
||||||
use App\Services\AccountService;
|
use App\Services\AccountService;
|
||||||
use App\Services\NetworkTimelineService;
|
use App\Services\NetworkTimelineService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
|
||||||
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use App\Services\Account\AccountStatService;
|
||||||
|
|
||||||
class DeleteRemoteStatusPipeline implements ShouldQueue
|
class DeleteRemoteStatusPipeline implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
@ -56,10 +56,7 @@ class DeleteRemoteStatusPipeline implements ShouldQueue
|
||||||
{
|
{
|
||||||
$status = $this->status;
|
$status = $this->status;
|
||||||
|
|
||||||
if(AccountService::get($status->profile_id, true)) {
|
AccountStatService::decrementPostCount($status->profile_id);
|
||||||
DecrementPostCount::dispatch($status->profile_id)->onQueue('low');
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkTimelineService::del($status->id);
|
NetworkTimelineService::del($status->id);
|
||||||
StatusService::del($status->id, true);
|
StatusService::del($status->id, true);
|
||||||
Bookmark::whereStatusId($status->id)->delete();
|
Bookmark::whereStatusId($status->id)->delete();
|
||||||
|
|
|
@ -39,8 +39,8 @@ use App\Services\AccountService;
|
||||||
use App\Services\CollectionService;
|
use App\Services\CollectionService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
||||||
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
|
||||||
use App\Services\NotificationService;
|
use App\Services\NotificationService;
|
||||||
|
use App\Services\Account\AccountStatService;
|
||||||
|
|
||||||
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||||
{
|
{
|
||||||
|
@ -109,9 +109,7 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusService::del($status->id, true);
|
StatusService::del($status->id, true);
|
||||||
|
AccountStatService::decrementPostCount($status->profile_id);
|
||||||
DecrementPostCount::dispatch($status->profile_id)->onQueue('inbox');
|
|
||||||
|
|
||||||
return $this->unlinkRemoveMedia($status);
|
return $this->unlinkRemoveMedia($status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,11 @@ class AccountStatService
|
||||||
return Redis::zadd(self::REFRESH_CACHE_KEY, $pid, $pid);
|
return Redis::zadd(self::REFRESH_CACHE_KEY, $pid, $pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function decrementPostCount($pid)
|
||||||
|
{
|
||||||
|
return Redis::zadd(self::REFRESH_CACHE_KEY, $pid, $pid);
|
||||||
|
}
|
||||||
|
|
||||||
public static function removeFromPostCount($pid)
|
public static function removeFromPostCount($pid)
|
||||||
{
|
{
|
||||||
return Redis::zrem(self::REFRESH_CACHE_KEY, $pid);
|
return Redis::zrem(self::REFRESH_CACHE_KEY, $pid);
|
||||||
|
|
|
@ -39,8 +39,6 @@ use App\Jobs\HomeFeedPipeline\FeedInsertRemotePipeline;
|
||||||
use App\Util\Media\License;
|
use App\Util\Media\License;
|
||||||
use App\Models\Poll;
|
use App\Models\Poll;
|
||||||
use Illuminate\Contracts\Cache\LockTimeoutException;
|
use Illuminate\Contracts\Cache\LockTimeoutException;
|
||||||
use App\Jobs\ProfilePipeline\IncrementPostCount;
|
|
||||||
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
|
||||||
use App\Services\DomainService;
|
use App\Services\DomainService;
|
||||||
use App\Services\UserFilterService;
|
use App\Services\UserFilterService;
|
||||||
use App\Services\Account\AccountStatService;
|
use App\Services\Account\AccountStatService;
|
||||||
|
|
|
@ -48,8 +48,6 @@ use App\Services\UserFilterService;
|
||||||
use App\Services\NetworkTimelineService;
|
use App\Services\NetworkTimelineService;
|
||||||
use App\Models\Conversation;
|
use App\Models\Conversation;
|
||||||
use App\Models\RemoteReport;
|
use App\Models\RemoteReport;
|
||||||
use App\Jobs\ProfilePipeline\IncrementPostCount;
|
|
||||||
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
|
||||||
use App\Jobs\HomeFeedPipeline\FeedRemoveRemotePipeline;
|
use App\Jobs\HomeFeedPipeline\FeedRemoveRemotePipeline;
|
||||||
|
|
||||||
class Inbox
|
class Inbox
|
||||||
|
|
Loading…
Reference in a new issue