Skip to content

Commit

Permalink
Merge pull request #225 from czqoocavatsim/dev
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
mufassilyasir authored Jun 30, 2023
2 parents e5d73d4 + 37b7dab commit 4c5a837
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
16 changes: 9 additions & 7 deletions app/Http/Controllers/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use GuzzleHttp\Client;
use App\Models\Users\User;
use App\Models\Users\UserNotificationPreferences;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use App\Models\Users\UserPreferences;
use App\Models\Users\UserPrivacyPreferences;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use App\Models\Users\UserPrivacyPreferences;
use App\Models\Users\UserNotificationPreferences;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;

/**
* Class AuthController.
Expand Down Expand Up @@ -131,6 +132,7 @@ public function validateConnectLogin(Request $request)
$notif->save();
}

Log::info($user->id.' logged in');
return redirect()->route('my.index')->with('success', "Welcome back, {$user->fullName('F')}!");
}
}
8 changes: 3 additions & 5 deletions app/Jobs/ProcessRosterInactivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,13 @@ public function handle()
}

if ($date === false){
if ($certifiedDate > Carbon::now()->startOfQuarter() && $certifiedDate < Carbon::now()->endOfQuarter()){
if ($certifiedDate > Carbon::now()->subDays(2)->startOfQuarter() && $certifiedDate < Carbon::now()->subDays(2)->endOfQuarter()){
continue;
}
}

if ($rosterMember->active) {
if ($rosterMember->currency < 6.0) {
$rosterMember->active = false;
$rosterMember->save();

$discord = new DiscordClient();
$discord_user_id = $rosterMember->user->discord_user_id;
if ($discord_user_id && $rosterMember->user->member_of_czqo){
Expand All @@ -69,7 +66,8 @@ public function handle()
}
$rosterMember->user->removeRole('Certified Controller');
$rosterMember->user->assignRole('Guest');
Notification::send($rosterMember->user, new RosterStatusChanged($rosterMember));
Notification::send($rosterMember->user, new RemovedFromRoster($rosterMember));
$rosterMember->delete();
}
}elseif (!$rosterMember->active) {
$rosterMember->delete();
Expand Down
3 changes: 0 additions & 3 deletions app/Models/Users/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ public function highestRole()
if (count($this->roles) == 0) {
//Assign them guest
$this->assignRole('Guest');

//Should probably inform
Log::alert('User '.$this->id.' did not have any role assigned. Guest role assigned.');
}

return $this->roles[0];
Expand Down
2 changes: 1 addition & 1 deletion app/Notifications/Roster/RemovedFromRoster.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class RemovedFromRoster extends Notification implements ShouldQueue
class RemovedFromRoster extends Notification
{
use Queueable;
protected $user;
Expand Down

0 comments on commit 4c5a837

Please sign in to comment.