update: pass types directly into some notifications

Only the request notifications for now, but they should all get done with time.
This commit is contained in:
Roardom
2024-03-01 17:46:40 +00:00
parent 00a993f101
commit c7408be672
8 changed files with 30 additions and 24 deletions
@@ -82,7 +82,7 @@ class ApprovedRequestFillController extends Controller
}
if ($filler->acceptsNotification($approver, $filler, 'request', 'show_request_fill_approve')) {
$filler->notify(new NewRequestFillApprove('torrent', $approver->username, $torrentRequest));
$filler->notify(new NewRequestFillApprove($torrentRequest));
}
return to_route('requests.show', ['torrentRequest' => $torrentRequest])
+2 -3
View File
@@ -46,7 +46,7 @@ class BountyController extends Controller
$user->decrement('seedbonus', $request->integer('seedbonus'));
$torrentRequest->bounties()->create(['user_id' => $user->id] + $request->validated());
$bounty = $torrentRequest->bounties()->create(['user_id' => $user->id] + $request->validated());
$torrentRequest->votes++;
$torrentRequest->bounty += $request->integer('seedbonus');
@@ -83,11 +83,10 @@ class BountyController extends Controller
);
}
$sender = $request->boolean('anon') ? 'Anonymous' : $request->user()->username;
$requester = $torrentRequest->user;
if ($requester->acceptsNotification($request->user(), $requester, 'request', 'show_request_bounty')) {
$requester->notify(new NewRequestBounty('torrent', $sender, $request->integer('seedbonus'), $torrentRequest));
$requester->notify(new NewRequestBounty($bounty));
}
return to_route('requests.show', ['torrentRequest' => $torrentRequest])
+2 -3
View File
@@ -36,17 +36,16 @@ class ClaimController extends Controller
->withErrors(trans('request.already-claimed'));
}
$torrentRequest->claim()->create(['user_id' => $request->user()->id] + $request->validated());
$claim = $torrentRequest->claim()->create(['user_id' => $request->user()->id] + $request->validated());
$torrentRequest->update([
'claimed' => true,
]);
$claimer = $request->boolean('anon') ? 'Anonymous' : $request->user()->username;
$requester = $torrentRequest->user;
if ($requester->acceptsNotification($request->user(), $requester, 'request', 'show_request_claim')) {
$requester->notify(new NewRequestClaim('torrent', $claimer, $torrentRequest));
$requester->notify(new NewRequestClaim($claim));
}
return to_route('requests.show', ['torrentRequest' => $torrentRequest])
@@ -50,7 +50,7 @@ class RequestFillController extends Controller
$requester = $torrentRequest->user;
if ($requester->acceptsNotification($request->user(), $requester, 'request', 'show_request_fill')) {
$requester->notify(new NewRequestFill('torrent', $sender, $torrentRequest));
$requester->notify(new NewRequestFill($torrentRequest));
}
return to_route('requests.show', ['torrentRequest' => $torrentRequest])