Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release Test PR] Release 2.35.1 #11876

Draft
wants to merge 35 commits into
base: release/2.34.1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6a09969
[Debt] User creation shifted to `authCallback()` (#11759)
vd1992 Oct 17, 2024
2ca1819
Bump nunomaduro/collision from 8.4.0 to 8.5.0 in /api (#11768)
dependabot[bot] Oct 17, 2024
f310adf
Bump the types group with 2 updates (#11774)
dependabot[bot] Oct 17, 2024
1a883b6
Bump react-toastify from 10.0.5 to 10.0.6 (#11776)
dependabot[bot] Oct 17, 2024
690094f
Bump @testing-library/jest-dom from 6.5.0 to 6.6.1 (#11778)
dependabot[bot] Oct 17, 2024
4ddbd91
Bump lcobucci/jwt from 5.3.0 to 5.4.0 in /api (#11772)
dependabot[bot] Oct 17, 2024
11b9e71
Bump staudenmeir/eloquent-has-many-deep from 1.20.3 to 1.20.4 in /api…
dependabot[bot] Oct 17, 2024
ec9d840
Bump @formatjs/cli from 6.2.14 to 6.2.15 (#11777)
dependabot[bot] Oct 17, 2024
1b12d03
Bump axe-core from 4.10.0 to 4.10.1 (#11786)
dependabot[bot] Oct 17, 2024
5e51467
Bump vite from 5.4.8 to 5.4.9 (#11788)
dependabot[bot] Oct 17, 2024
d4e047f
Bump eslint-plugin-playwright from 1.6.2 to 1.7.0 (#11783)
dependabot[bot] Oct 17, 2024
975820c
Bump @playwright/test from 1.48.0 to 1.48.1 (#11785)
dependabot[bot] Oct 17, 2024
8aa6a93
Bump @formatjs/ts-transformer from 3.13.15 to 3.13.16 (#11780)
dependabot[bot] Oct 17, 2024
f19a03e
Bump react-router-dom from 6.26.2 to 6.27.0 (#11779)
dependabot[bot] Oct 17, 2024
b34e6d3
Bump the typescript-eslint group across 1 directory with 3 updates (#…
dependabot[bot] Oct 17, 2024
d6e0897
Bump eslint-plugin-testing-library from 6.3.0 to 6.3.2 (#11781)
dependabot[bot] Oct 17, 2024
8c52e50
[Feature] Accordion middle partials (#11674)
yonikid15 Oct 17, 2024
780ecfa
Bump eslint-plugin-formatjs from 5.0.2 to 5.1.0 (#11784)
dependabot[bot] Oct 17, 2024
5b55ffd
Bump eslint-plugin-react-hooks from 4.6.2 to 5.0.0 (#11787)
dependabot[bot] Oct 17, 2024
b9fb4ad
[Feature] Manager request history page (#11761)
petertgiles Oct 18, 2024
7927165
[Fix] PHP parameter errors (#11739)
esizer Oct 18, 2024
48fe1ca
change logging level (#11797)
petertgiles Oct 18, 2024
01a62b0
Bump larastan/larastan from 2.9.8 to 2.9.9 in /api (#11771)
dependabot[bot] Oct 18, 2024
a423bce
[Feature] Updated/new hero component (#11713)
vd1992 Oct 18, 2024
98953e8
[Test] Add experience regression test (#11752)
esizer Oct 22, 2024
4c3cf68
Update first paragraph for privacy policy page (#11814)
mnigh Oct 22, 2024
d0786b4
Add department (#11806)
mnigh Oct 22, 2024
9def18c
[Fix] `margin-right` on radio group section (#11808)
mnigh Oct 22, 2024
57db2a0
Update French Sub title for the websites privacy policy (#11817)
mnigh Oct 22, 2024
0dd0e88
[FIX] Log entire CSP report message (#11800)
petertgiles Oct 22, 2024
d1bd00c
Add job templates link and button to admin (#11816)
mnigh Oct 23, 2024
a91e661
If community doesn't have team, create one in seeder (#11810)
tristan-orourke Oct 23, 2024
4114dee
Avoid loading teamable in myAuth query (#11812)
tristan-orourke Oct 23, 2024
8b05060
[Feature] Admin view and edit work email (#11813)
JamesHuf Oct 23, 2024
3ce1fbd
[FEATURE] Training fund page (#11821)
petertgiles Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/app/Checkers/ProtectedRequestUserChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function currentUserHasRole(
bool $requireAll = false
): bool {
if (! $this->isSafeToUseRole($name)) {
Log::warning('Tried to unsafely use role '.json_encode($name));
Log::debug('Tried to unsafely use role '.json_encode($name));

return false; // user effectively doesn't have role if it is unsafe to use it
}
Expand All @@ -77,7 +77,7 @@ public function currentUserHasPermission(
bool $requireAll = false
): bool {
if (! $this->isSafeToUsePermission($permission)) {
Log::warning('Tried to unsafely use permission '.json_encode($permission));
Log::debug('Tried to unsafely use permission '.json_encode($permission));

return false; // user effectively doesn't have permission if it is unsafe to use it
}
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/ArchivePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __invoke($_, array $args)
{
$pool = Pool::find($args['id']);
if ($pool->getStatusAttribute() !== PoolStatus::CLOSED->name) {
throw ValidationException::withMessages(['ArchivePoolInvalidStatus']);
throw ValidationException::withMessages(['id' => 'ArchivePoolInvalidStatus']);
}
$pool->update(['archived_at' => Carbon::now()]);

Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/CreateUserSkill.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __invoke($_, array $args): UserSkill

return $existingModel;
}
throw ValidationException::withMessages(['DuplicateUserSkill']);
throw ValidationException::withMessages(['skill_id' => 'DuplicateUserSkill']);
}

$createdModel = UserSkill::create([
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/DeleteApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __invoke($_, array $args)
// execute hard delete and verify model was deleted by checking that is not true
$success = $application->forceDelete();
if (! $success) {
throw ValidationException::withMessages([ApiErrorEnums::APPLICATION_DELETE_FAILED]);
throw ValidationException::withMessages(['id' => ApiErrorEnums::APPLICATION_DELETE_FAILED]);
}

return $application;
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/ReinstateCandidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __invoke($_, array $args)
$candidate->pool_candidate_status = PoolCandidateStatus::NEW_APPLICATION->name;
break;
default:
throw ValidationException::withMessages(['CandidateUnexpectedStatus']);
throw ValidationException::withMessages(['id' => 'CandidateUnexpectedStatus']);
}

$candidate->removed_at = null;
Expand Down
6 changes: 3 additions & 3 deletions api/app/GraphQL/Mutations/RemoveCandidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public function __invoke($_, array $args)
case PoolCandidateStatus::PLACED_CASUAL->name:
case PoolCandidateStatus::PLACED_TERM->name:
case PoolCandidateStatus::PLACED_INDETERMINATE->name:
throw ValidationException::withMessages(['RemoveCandidateAlreadyPlaced']);
throw ValidationException::withMessages(['id' => 'RemoveCandidateAlreadyPlaced']);
case PoolCandidateStatus::SCREENED_OUT_NOT_INTERESTED->name:
case PoolCandidateStatus::SCREENED_OUT_NOT_RESPONSIVE->name:
case PoolCandidateStatus::QUALIFIED_UNAVAILABLE->name:
case PoolCandidateStatus::QUALIFIED_WITHDREW->name:
case PoolCandidateStatus::REMOVED->name:
throw ValidationException::withMessages(['RemoveCandidateAlreadyRemoved']);
throw ValidationException::withMessages(['id' => 'RemoveCandidateAlreadyRemoved']);
default:
throw ValidationException::withMessages(['CandidateUnexpectedStatus']);
throw ValidationException::withMessages(['id' => 'CandidateUnexpectedStatus']);
}

$candidate->save();
Expand Down
4 changes: 2 additions & 2 deletions api/app/GraphQL/Mutations/SwapAssessmentStepOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public function __invoke($_, array $args)

// Ensure the steps belong to the same pool
if ($stepA->pool_id !== $stepB->pool_id) {
throw ValidationException::withMessages(['AssessmentStepsSamePool']);
throw ValidationException::withMessages(['stepIdA' => 'AssessmentStepsSamePool']);
}

// Don't swap the reserved first two spots
if ($stepA->sort_order < 3 || $stepB->sort_order < 3) {
throw ValidationException::withMessages(['AssessmentStepCannotSwap']);
throw ValidationException::withMessages(['stepIdA' => 'AssessmentStepCannotSwap']);
}

DB::beginTransaction();
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/UnarchivePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __invoke($_, array $args)
{
$pool = Pool::find($args['id']);
if ($pool->getStatusAttribute() !== PoolStatus::ARCHIVED->name) {
throw ValidationException::withMessages(['UnarchivePoolInvalidStatus']);
throw ValidationException::withMessages(['status' => 'UnarchivePoolInvalidStatus']);
}
$pool->update(['archived_at' => null]);

Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/UpdateUserSkillRankings.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class UpdateUserSkillRankings
/**
* Update a user's UserSkill rankings
*
* @param array{userId: UUID, userSkillRanking: UpdateUserSkillRankingsInput} $args
* @param array{userId: string, userSkillRanking: array} $args
* @return User
*/
public function __invoke($_, array $args)
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Mutations/VerifyUserEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __invoke($_, array $args)
}

if (! $isValid) {
throw ValidationException::withMessages(['VERIFICATION_FAILED']);
throw ValidationException::withMessages(['code' => 'VERIFICATION_FAILED']);
}

// by now, token seems good
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function rules(): array
];

if (! (in_array($candidate->pool_candidate_status, $statusesArray))) {
throw ValidationException::withMessages([ApiErrorEnums::INVALID_STATUS_DISQUALIFICATION]);
throw ValidationException::withMessages(['status' => ApiErrorEnums::INVALID_STATUS_DISQUALIFICATION]);
}

return [];
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Validators/PlaceCandidateValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function rules(): array
$statusesArray = [...$placedStatuses, PoolCandidateStatus::QUALIFIED_AVAILABLE->name];

if (! (in_array($candidate->pool_candidate_status, $statusesArray))) {
throw ValidationException::withMessages([ApiErrorEnums::INVALID_STATUS_PLACING]);
throw ValidationException::withMessages(['id' => ApiErrorEnums::INVALID_STATUS_PLACING]);
}

return [
Expand Down
2 changes: 1 addition & 1 deletion api/app/GraphQL/Validators/QualifyCandidateValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function rules(): array
];

if (! (in_array($candidate->pool_candidate_status, $statusesArray))) {
throw ValidationException::withMessages([ApiErrorEnums::INVALID_STATUS_QUALIFICATION]);
throw ValidationException::withMessages(['id' => ApiErrorEnums::INVALID_STATUS_QUALIFICATION]);
}

return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function rules(): array
];

if (! (in_array($candidate->pool_candidate_status, $statusesArray))) {
throw ValidationException::withMessages([ApiErrorEnums::INVALID_STATUS_REVERT_FINAL_DECISION]);
throw ValidationException::withMessages(['id' => ApiErrorEnums::INVALID_STATUS_REVERT_FINAL_DECISION]);
}

return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function rules(): array
$placedStatuses = array_column(PlacementType::cases(), 'name');

if (! (in_array($candidate->pool_candidate_status, $placedStatuses))) {
throw ValidationException::withMessages([ApiErrorEnums::CANDIDATE_NOT_PLACED]);
throw ValidationException::withMessages(['id' => ApiErrorEnums::CANDIDATE_NOT_PLACED]);
}

return [];
Expand Down
11 changes: 11 additions & 0 deletions api/app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers;

use App\Models\Role;
use App\Models\User;
use App\Services\OpenIdBearerTokenService;
use Carbon\Carbon;
Expand Down Expand Up @@ -122,6 +123,16 @@ public function authCallback(Request $request)
if (isset($userMatch)) {
$userMatch->last_sign_in_at = $now;
$userMatch->save();
} else {
// No user found for given subscriber - lets auto-register them
$newUser = new User;
$newUser->sub = $sub;
$newUser->last_sign_in_at = $now;
$newUser->save();
$newUser->syncRoles([ // every new user is automatically an base_user and an applicant
Role::where('name', 'base_user')->sole(),
Role::where('name', 'applicant')->sole(),
], null);
}

$query = http_build_query($response->json());
Expand Down
7 changes: 2 additions & 5 deletions api/app/Http/Controllers/CspReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ public function report(Request $request)
{
$report = $request->json()->all();
$message = sprintf(
'CSP violation, %s, %s, %s, %s',
$report['csp-report']['blocked-uri'] ?? '',
$report['csp-report']['violated-directive'] ?? '',
$report['csp-report']['source-file'] ?? '',
json_encode($report['csp-report'])
'CSP violation, %s',
json_encode($report)
);

Log::warning($message);
Expand Down
17 changes: 9 additions & 8 deletions api/app/Models/Experience.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
/**
* Class Experience
*
* @property int $id
* @property int $user_id
* @property string $id
* @property string $user_id
* @property \Illuminate\Support\Carbon $start_date
* @property ?\Illuminate\Support\Carbon $end_date
* @property \Illuminate\Support\Carbon $created_at
Expand All @@ -37,13 +37,14 @@ class Experience extends Model
/**
* Create a new concrete model instance that is existing, based on the type field.
*
* @param object $attributes
* @param mixed $attributes
* @param string|null $connection
* @return static
*/
public function newFromBuilder($attributes = [], $connection = null)
{
$model = $this->newInstanceFromType($attributes->experience_type);
/** @disregard Even though it is typed as an array, it is actually a class */
$model = $this->newInstanceFromType(((object) $attributes)->experience_type);

$model->exists = true;

Expand Down Expand Up @@ -234,7 +235,7 @@ protected static function getJsonPropertyDate(array $attributes, string $propert
return null;
}

protected static function setJsonPropertyDate(mixed $value, array $attributes, string $propertyName)
protected static function setJsonPropertyDate(mixed $value, ?array $attributes, string $propertyName)
{
$properties = json_decode($attributes['properties'] ?? '{}');
if (! empty($value)) {
Expand All @@ -249,8 +250,8 @@ protected static function setJsonPropertyDate(mixed $value, array $attributes, s
protected function makeJsonPropertyDateAttribute(string $propertyName): Attribute
{
return Attribute::make(
get: fn (mixed $value, array $attributes) => $this::getJsonPropertyDate($attributes, $propertyName),
set: fn (mixed $value, array $attributes) => $this::setJsonPropertyDate($value, $attributes, $propertyName)
get: fn (mixed $value, mixed $attributes) => $this::getJsonPropertyDate($attributes, $propertyName),
set: fn (mixed $value, ?array $attributes = []) => $this::setJsonPropertyDate($value, $attributes, $propertyName)
);
}

Expand All @@ -277,7 +278,7 @@ protected function makeJsonPropertyStringAttribute(string $propertyName): Attrib
{
return Attribute::make(
get: fn (mixed $value, array $attributes) => $this::getJsonPropertyString($attributes, $propertyName),
set: fn (mixed $value, array $attributes) => $this::setJsonPropertyString($value, $attributes, $propertyName)
set: fn (mixed $value, ?array $attributes = []) => $this::setJsonPropertyString($value, $attributes, $propertyName)
);
}

Expand Down
11 changes: 10 additions & 1 deletion api/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public function getDepartment()
return '';
}

return $this->department()->get('name');
return $this->department()->get(['name']);
}

public function getPriorityAttribute()
Expand Down Expand Up @@ -974,6 +974,15 @@ public static function scopeEmail(Builder $query, ?string $email): Builder
return $query;
}

public static function scopeWorkEmail(Builder $query, ?string $email): Builder
{
if ($email) {
$query->where('work_email', 'ilike', "%{$email}%");
}

return $query;
}

public static function scopeIsGovEmployee(Builder $query, ?bool $isGovEmployee): Builder
{
if ($isGovEmployee) {
Expand Down
10 changes: 5 additions & 5 deletions api/app/Notify/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function sendSms($to, $template, $personalisation = [], $reference = null
* ]
* ]
* @param string $template ID of the template to use
* @param Carbon\Carbon $scheduleFor (optional)
* @param \Illuminate\Support\Carbon $scheduleFor (optional)
* @param string $replyTo (optional) ID for a reply to email address
*/
public function sendBulkEmail($name, $rows, $template, $scheduleFor = null, $replyTo = null)
Expand All @@ -115,7 +115,7 @@ public function sendBulkEmail($name, $rows, $template, $scheduleFor = null, $rep
* ]
* ]
* @param string $template ID of the template to use
* @param Carbon\Carbon $scheduleFor (optional)
* @param \Illuminate\Support\Carbon $scheduleFor (optional)
* @param string $replyTo (optional) ID for a reply to email address
*/
public function sendBulkSms($name, $rows, $template, $scheduleFor = null, $replyTo = null)
Expand Down Expand Up @@ -211,7 +211,7 @@ private function buildSmsPayload($to, $template, $personalisation = [], $referen
* @param string $name Used to identify this bulk of notifications later on.
* @param array<mixed> $rows The recipient of the notification
* @param string $template Template of the notification
* @param Carbon\Carbon $scheduleFor (optional)
* @param \Illuminate\Support\Carbon $scheduleFor (optional)
* @param string $replyTo (optional) ID for a reply to email address
* @return array<mixed> The partial payload
*/
Expand Down Expand Up @@ -243,7 +243,7 @@ private function buildBulkPayload($name, $rows, $template, $scheduleFor = null,
* @param string $name Used to identify this bulk of notifications later on.
* @param array<mixed> $rows The recipient of the notification
* @param string $template Template of the notification
* @param Carbon\Carbon $scheduleFor (optional)
* @param \Illuminate\Support\Carbon $scheduleFor (optional)
* @param string $replyTo (optional) ID for a reply to email address
* @return array<mixed> The partial payload
*/
Expand Down Expand Up @@ -285,7 +285,7 @@ private function buildBulkEmailPayload($name, $rows, $template, $scheduleFor = n
* @param string $name Used to identify this bulk of notifications later on.
* @param array<mixed> $rows The recipient of the notification
* @param string $template Template of the notification
* @param Carbon\Carbon $scheduleFor (optional)
* @param \Illuminate\Support\Carbon $scheduleFor (optional)
* @param string $replyTo (optional) ID for a reply to email address
* @return array<mixed> The partial payload
*/
Expand Down
2 changes: 1 addition & 1 deletion api/app/Policies/UserPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function updateSub(User $user)
/**
* Determine whether the user can update roles.
*
* @param UpdateUserRolesInput $args
* @param array{id: ?string, roleAssignmentsInput: ?array{attach: ?array, detach: ?array}} $args
* @return \Illuminate\Auth\Access\Response|bool
*/
public function updateRoles(User $user, $args)
Expand Down
13 changes: 2 additions & 11 deletions api/app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use App\Models\PersonalExperience;
use App\Models\Pool;
use App\Models\PoolCandidate;
use App\Models\Role;
use App\Models\User;
use App\Models\WorkExperience;
use App\Policies\ClassificationPolicy;
Expand Down Expand Up @@ -103,16 +102,8 @@ public function resolveUserOrAbort($bearerToken, $tokenService): ?User

return $userMatch;
} else {
// No user found for given subscriber - lets auto-register them
$newUser = new User;
$newUser->sub = $sub;
$newUser->save();
$newUser->syncRoles([ // every new user is automatically an base_user and an applicant
Role::where('name', 'base_user')->sole(),
Role::where('name', 'applicant')->sole(),
], null);

return $newUser;
// No user found for given subscriber
throw new AuthenticationException('Login as un-retrievable user: '.$sub, 'user_not_found');
}
}

Expand Down
Loading
Loading