Update Like, Status and Comment controllers to add StatusService del() method to update counts

This commit is contained in:
Daniel Supernault 2021-01-30 16:25:50 -07:00
parent 05b9445c8f
commit eab4370c84
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
3 changed files with 8 additions and 1 deletions

View File

@ -18,6 +18,7 @@ use League\Fractal;
use App\Transformer\Api\StatusTransformer;
use League\Fractal\Serializer\ArraySerializer;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use App\Services\StatusService;
class CommentController extends Controller
{
@ -78,6 +79,7 @@ class CommentController extends Controller
return $reply;
});
StatusService::del($status->id);
NewStatusPipeline::dispatch($reply, false);
CommentPipeline::dispatch($status, $reply);

View File

@ -9,6 +9,7 @@ use App\User;
use Auth;
use Cache;
use Illuminate\Http\Request;
use App\Services\StatusService;
class LikeController extends Controller
{
@ -58,6 +59,7 @@ class LikeController extends Controller
}
Cache::forget('status:'.$status->id.':likedby:userid:'.$user->id);
StatusService::del($status->id);
if ($request->ajax()) {
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];

View File

@ -20,6 +20,7 @@ use League\Fractal;
use App\Util\Media\Filter;
use Illuminate\Support\Str;
use App\Services\HashidService;
use App\Services\StatusService;
class StatusController extends Controller
{
@ -211,6 +212,7 @@ class StatusController extends Controller
Cache::forget('_api:statuses:recent_9:' . $status->profile_id);
Cache::forget('profile:status_count:' . $status->profile_id);
StatusService::del($status->id);
if ($status->profile_id == $user->profile->id || $user->is_admin == true) {
Cache::forget('profile:status_count:'.$status->profile_id);
StatusDelete::dispatch($status);
@ -266,7 +268,8 @@ class StatusController extends Controller
}
Cache::forget('status:'.$status->id.':sharedby:userid:'.$user->id);
StatusService::del($status->id);
if ($request->ajax()) {
$response = ['code' => 200, 'msg' => 'Share saved', 'count' => $count];
} else {