Update AP helpers, refactor post count decrement logic

This commit is contained in:
Daniel Supernault 2024-02-04 02:50:48 -07:00
parent ddf7f09ad4
commit b81ae5773f
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
5 changed files with 9 additions and 13 deletions

View file

@ -22,9 +22,9 @@ use App\Notification;
use App\Services\AccountService;
use App\Services\NetworkTimelineService;
use App\Services\StatusService;
use App\Jobs\ProfilePipeline\DecrementPostCount;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
use Cache;
use App\Services\Account\AccountStatService;
class DeleteRemoteStatusPipeline implements ShouldQueue
{
@ -56,10 +56,7 @@ class DeleteRemoteStatusPipeline implements ShouldQueue
{
$status = $this->status;
if(AccountService::get($status->profile_id, true)) {
DecrementPostCount::dispatch($status->profile_id)->onQueue('low');
}
AccountStatService::decrementPostCount($status->profile_id);
NetworkTimelineService::del($status->id);
StatusService::del($status->id, true);
Bookmark::whereStatusId($status->id)->delete();

View file

@ -39,8 +39,8 @@ use App\Services\AccountService;
use App\Services\CollectionService;
use App\Services\StatusService;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
use App\Jobs\ProfilePipeline\DecrementPostCount;
use App\Services\NotificationService;
use App\Services\Account\AccountStatService;
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
{
@ -109,9 +109,7 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
}
StatusService::del($status->id, true);
DecrementPostCount::dispatch($status->profile_id)->onQueue('inbox');
AccountStatService::decrementPostCount($status->profile_id);
return $this->unlinkRemoveMedia($status);
}

View file

@ -14,6 +14,11 @@ class AccountStatService
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)
{
return Redis::zrem(self::REFRESH_CACHE_KEY, $pid);

View file

@ -39,8 +39,6 @@ use App\Jobs\HomeFeedPipeline\FeedInsertRemotePipeline;
use App\Util\Media\License;
use App\Models\Poll;
use Illuminate\Contracts\Cache\LockTimeoutException;
use App\Jobs\ProfilePipeline\IncrementPostCount;
use App\Jobs\ProfilePipeline\DecrementPostCount;
use App\Services\DomainService;
use App\Services\UserFilterService;
use App\Services\Account\AccountStatService;

View file

@ -48,8 +48,6 @@ use App\Services\UserFilterService;
use App\Services\NetworkTimelineService;
use App\Models\Conversation;
use App\Models\RemoteReport;
use App\Jobs\ProfilePipeline\IncrementPostCount;
use App\Jobs\ProfilePipeline\DecrementPostCount;
use App\Jobs\HomeFeedPipeline\FeedRemoveRemotePipeline;
class Inbox