Skip to content

Commit

Permalink
Merge pull request #284 from czqoocavatsim/JoshuaNeedsCoffee
Browse files Browse the repository at this point in the history
Fix Remove Button Issue
  • Loading branch information
JoshuaMicallefYBSU authored Aug 15, 2024
2 parents 6c75cbb + 78dd217 commit e3d5875
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Training/InstructingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,15 @@ public function removeStudent($cid)
$student->user->removeRole('Student');

//Discord Updates
if ($student->user->hasDiscord() && $student->user->member_of_czqo) {
if (!$student->user->hasDiscord()) {
//Get Discord client
$discord = new DiscordClient();

//remove student discord role
$discord->removeRole($student->user->discord_user_id, 482824058141016075);

$discord->EditThreadTag('Inactive', $student->user->fullName('FLC'));

//close Instructor Thread
$discord->closeTrainingThread($student->user->fullName('FLC'), 'cancel');

Expand Down
18 changes: 9 additions & 9 deletions app/Services/DiscordClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ public function closeTrainingThread($name, $status)
foreach ($threads_data['threads'] as $thread) {
if ($thread['name'] == $name) {

// Lock and Archive the Thread
$data = $this->client->patch('channels/'.$thread['id'], [
'json' => [
'locked' => true,
'archived' => true,
]
]);

if($status == "certify"){
$this->sendMessageWithEmbed($thread['id'], 'Oceanic Training Completed!',
'Congratulations, you have now been certified on Gander & Shanwick Oceanic!
Expand All @@ -137,19 +145,11 @@ public function closeTrainingThread($name, $status)
Enjoy controlling Gander & Shanwick OCA!');
} elseif($status == "cancel") {
$this->sendMessageWithEmbed($thread['id'], 'Oceanic Training Cancelled!',
$this->sendMessageWithEmbed($thread['id'], 'Oceanic Training Cancelled',
'Your training request with Gander Oceanic has been terminated.
If you would like to begin training again, please re-apply via the Gander Website.');
}

// Lock and Archive the Thread
$data = $this->client->patch('channels/'.$thread['id'], [
'json' => [
'locked' => true,
'archived' => true,
]
]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
</ul>
<h5 class="blue-text">Actions</h5>
<ul class="list-unstyled mt-2">
@can('edit students')
@if(Auth::user()->id == "1342084" || Auth::user()->hasRole('Instructor'))
<div class="list-group z-depth-1">
<a data-target="#deleteStudentModal" data-toggle="modal" class="list-group-item list-group-item-action red-text"><i class="fas fa-dumpster-fire mr-3"></i>Remove User as Student</a>
</div>
@endcan
@endif
@if($student->user->rosterProfile->certification == "training")
<div class="list-group z-depth-1">
<a data-target="#certifyStudentModal" data-toggle="modal" class="list-group-item list-group-item-action green-text"><i class="fas fa-check mr-3"></i>Certify Controller</a>
Expand Down
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@

//Base level authentication
Route::group(['middleware' => 'auth'], function () {

// Privacy accept
Route::post('/privacyaccept', [MyCzqoController::class, 'acceptPrivacyPolicy'])->name('privacyaccept');
Route::get('/privacydeny', [MyCzqoController::class, 'denyPrivacyPolicy']);
Expand Down

0 comments on commit e3d5875

Please sign in to comment.