Skip to content

Commit 0fa9ca8

Browse files
krlmrrKarl Murray
andauthored
[ADVAPP-1933]: Introduce a new setting on alerts that will be used to make alerts visible to students in the student portal (#1913)
* [ADVAPP-1933]: Add check box / Update Model / Migration / Feature * Update code formatting and copyright headers * [ADVAPP-1933]: Add a default false on Visable to students * [ADVAPP-1933]: Swap for toggle --------- Co-authored-by: Karl Murray <karl.murray@canyongbs.com>
1 parent 2d82b18 commit 0fa9ca8

4 files changed

Lines changed: 120 additions & 0 deletions

File tree

app-modules/alert/src/Models/Alert.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ class Alert extends BaseModel implements Auditable, CanTriggerAutoSubscription,
7979
'severity',
8080
'suggested_intervention',
8181
'status_id',
82+
'is_visible_for_students',
8283
];
8384

8485
protected $casts = [
8586
'severity' => AlertSeverity::class,
87+
'is_visible_for_students' => 'boolean',
8688
];
8789

8890
public function processCustomHistories(string $event, Collection $old, Collection $new, Collection $pending): void
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
/*
4+
<COPYRIGHT>
5+
6+
Copyright © 2016-2025, Canyon GBS LLC. All rights reserved.
7+
8+
Advising App™ is licensed under the Elastic License 2.0. For more details,
9+
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE.
10+
11+
Notice:
12+
13+
- You may not provide the software to third parties as a hosted or managed
14+
service, where the service provides users with access to any substantial set of
15+
the features or functionality of the software.
16+
- You may not move, change, disable, or circumvent the license key functionality
17+
in the software, and you may not remove or obscure any functionality in the
18+
software that is protected by the license key.
19+
- You may not alter, remove, or obscure any licensing, copyright, or other notices
20+
of the licensor in the software. Any use of the licensor’s trademarks is subject
21+
to applicable law.
22+
- Canyon GBS LLC respects the intellectual property rights of others and expects the
23+
same in return. Canyon GBS™ and Advising App™ are registered trademarks of
24+
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
25+
vigorously.
26+
- The software solution, including services, infrastructure, and code, is offered as a
27+
Software as a Service (SaaS) by Canyon GBS LLC.
28+
- Use of this software implies agreement to the license terms and conditions as stated
29+
in the Elastic License 2.0.
30+
31+
For more information or inquiries please visit our website at
32+
https://www.canyongbs.com or contact us via email at legal@canyongbs.com.
33+
34+
</COPYRIGHT>
35+
*/
36+
37+
use App\Features\AlertVisibleToStudentsFeature;
38+
use Illuminate\Database\Migrations\Migration;
39+
use Illuminate\Support\Facades\DB;
40+
use Tpetry\PostgresqlEnhanced\Schema\Blueprint;
41+
use Tpetry\PostgresqlEnhanced\Support\Facades\Schema;
42+
43+
return new class () extends Migration {
44+
public function up(): void
45+
{
46+
DB::transaction(function () {
47+
Schema::table('alerts', function (Blueprint $table) {
48+
$table->boolean('is_visible_for_students')
49+
->default(false);
50+
});
51+
52+
AlertVisibleToStudentsFeature::activate();
53+
});
54+
}
55+
56+
public function down(): void
57+
{
58+
DB::transaction(function () {
59+
AlertVisibleToStudentsFeature::purge();
60+
61+
Schema::table('alerts', function (Blueprint $table) {
62+
$table->dropColumn('is_visible_for_students');
63+
});
64+
});
65+
}
66+
};

app-modules/student-data-model/src/Filament/Resources/EducatableResource/Pages/Concerns/CanManageEducatableAlerts.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838

3939
use AdvisingApp\Alert\Enums\AlertSeverity;
4040
use AdvisingApp\Alert\Enums\SystemAlertStatusClassification;
41+
use App\Features\AlertVisibleToStudentsFeature;
4142
use App\Filament\Tables\Columns\IdColumn;
4243
use Filament\Forms\Components\Select;
4344
use Filament\Forms\Components\Textarea;
45+
use Filament\Forms\Components\Toggle;
4446
use Filament\Forms\Form;
4547
use Filament\Infolists\Components\TextEntry;
4648
use Filament\Infolists\Infolist;
@@ -101,6 +103,9 @@ public function form(Form $form): Form
101103
->relationship('status', 'name', fn (Builder $query) => $query->orderBy('order'))
102104
->default(fn () => SystemAlertStatusClassification::default()?->getKey())
103105
->required(),
106+
Toggle::make('is_visible_for_students')
107+
->label('Make visible to students')
108+
->visible(AlertVisibleToStudentsFeature::active()),
104109
]);
105110
}
106111

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
<COPYRIGHT>
5+
6+
Copyright © 2016-2025, Canyon GBS LLC. All rights reserved.
7+
8+
Advising App™ is licensed under the Elastic License 2.0. For more details,
9+
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE.
10+
11+
Notice:
12+
13+
- You may not provide the software to third parties as a hosted or managed
14+
service, where the service provides users with access to any substantial set of
15+
the features or functionality of the software.
16+
- You may not move, change, disable, or circumvent the license key functionality
17+
in the software, and you may not remove or obscure any functionality in the
18+
software that is protected by the license key.
19+
- You may not alter, remove, or obscure any licensing, copyright, or other notices
20+
of the licensor in the software. Any use of the licensor’s trademarks is subject
21+
to applicable law.
22+
- Canyon GBS LLC respects the intellectual property rights of others and expects the
23+
same in return. Canyon GBS™ and Advising App™ are registered trademarks of
24+
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
25+
vigorously.
26+
- The software solution, including services, infrastructure, and code, is offered as a
27+
Software as a Service (SaaS) by Canyon GBS LLC.
28+
- Use of this software implies agreement to the license terms and conditions as stated
29+
in the Elastic License 2.0.
30+
31+
For more information or inquiries please visit our website at
32+
https://www.canyongbs.com or contact us via email at legal@canyongbs.com.
33+
34+
</COPYRIGHT>
35+
*/
36+
37+
namespace App\Features;
38+
39+
use App\Support\AbstractFeatureFlag;
40+
41+
class AlertVisibleToStudentsFeature extends AbstractFeatureFlag
42+
{
43+
public function resolve(mixed $scope): mixed
44+
{
45+
return false;
46+
}
47+
}

0 commit comments

Comments
 (0)