Update ApiV1Dot1Controller, allow upto 5 similar push tokens

This commit is contained in:
Daniel Supernault 2024-10-08 02:26:01 -06:00
parent 989a8e9328
commit 7820b506d8
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -1139,7 +1139,7 @@ class ApiV1Dot1Controller extends Controller
$expoToken = $request->input('token'); $expoToken = $request->input('token');
$existing = User::where('profile_id', '!=', $pid)->whereExpoToken($expoToken)->count(); $existing = User::where('profile_id', '!=', $pid)->whereExpoToken($expoToken)->count();
abort_if($existing, 400, 'Push token is already used by another account'); abort_if($existing && $existing > 5, 400, 'Push token is already used by another account');
$request->user()->update([ $request->user()->update([
'notify_enabled' => $request->boolean('notify_enabled'), 'notify_enabled' => $request->boolean('notify_enabled'),