Skip to content

Commit

Permalink
Merge branch 'dev' into modalForExternalRedirects
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpar06 authored Feb 28, 2024
2 parents 45b8318 + 143d927 commit c0774c3
Show file tree
Hide file tree
Showing 55 changed files with 845 additions and 1,007 deletions.
17 changes: 6 additions & 11 deletions .github/scripts/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap/autoload.php"
colors="true"
testdox="true"
processIsolation="false"
stopOnFailure="true"
convertErrorsToExceptions="false"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"
beStrictAboutOutputDuringTests="false"
beStrictAboutTestsThatDoNotTestAnything="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<extensions>
<extension class="Tests\Bootstrap"/>
</extensions>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<!--<listeners>
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
</listeners>-->
Expand All @@ -42,4 +32,9 @@
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
</php>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php-versions: ['8.1', '8.2']
php-versions: ['8.1', '8.2', '8.3']
name: PHP ${{ matrix.php-versions }}
env:
extensions: intl, pcov, mbstring
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
run: |
export PHP_CS_FIXER_IGNORE_ENV=1
#vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --diff --using-cache=no
vendor/bin/phpunit --debug --verbose
vendor/bin/phpunit
# This runs after all of the tests, run have run. Creates a cleaned up version of the
# distro, and then creates the artifact to push up to S3 or wherever
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ _ide_helper.php
.php_cs.cache
.phpstorm.meta.php
.phpunit.result.cache
.phpunit.cache
/vendor
node_modules/
npm-debug.log
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ tests: test
.PHONY: test
test:
@#php artisan database:create --reset
@vendor/bin/phpunit --verbose
@vendor/bin/phpunit

.PHONY: phpcs
phpcs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::table('user_oauth_tokens', function (Blueprint $table) {
$foreignKeys = Schema::getForeignKeys('user_oauth_tokens');
if (DB::getDriverName() !== 'sqlite') {
Schema::table('user_oauth_tokens', function (Blueprint $table) {
$foreignKeys = Schema::getForeignKeys('user_oauth_tokens');

foreach ($foreignKeys as $foreignKey) {
if (in_array('user_id', $foreignKey['columns'], true)) {
$table->dropForeign(['user_id']);
break;
foreach ($foreignKeys as $foreignKey) {
if (in_array('user_id', $foreignKey['columns'], true)) {
$table->dropForeign(['user_id']);
break;
}
}
}
});
});
}
}

public function down(): void
Expand Down
7 changes: 7 additions & 0 deletions app/Database/seeds/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -542,3 +542,10 @@
options: ''
type: boolean
description: Send out a discord notification when a pirep is diverted
- key: notifications.discord_pirep_filed
name: Discord Pirep Filed Message (Public)
group: notifications
value: true
options: ''
type: boolean
description: Send out a discord notification when a pirep is filed
14 changes: 5 additions & 9 deletions app/Http/Controllers/Api/PirepController.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ public function get(string $id): PirepResource
*/
public function prefile(PrefileRequest $request): PirepResource
{
Log::info('PIREP Prefile, user '.Auth::id(), $request->post());

/**
* @var $user \App\Models\User
*/
Expand All @@ -221,8 +219,7 @@ public function prefile(PrefileRequest $request): PirepResource
$fares = $this->getFares($request);
$pirep = $this->pirepSvc->prefile($user, $attrs, $fields, $fares);

Log::info('PIREP PREFILED');
Log::info($pirep->id);
Log::info('PIREP Prefile, pirep_id: '.$pirep->id.', user_id: '.Auth::id());

return $this->get($pirep->id);
}
Expand All @@ -244,8 +241,7 @@ public function prefile(PrefileRequest $request): PirepResource
*/
public function update(string $pirep_id, UpdateRequest $request): PirepResource
{
Log::info('PIREP Update, user '.Auth::id());
Log::info($request->getContent());
Log::debug('PIREP Update, pirep_id: '.$pirep_id.', user_id: '.Auth::id());

/** @var User $user */
$user = Auth::user();
Expand Down Expand Up @@ -292,7 +288,7 @@ public function update(string $pirep_id, UpdateRequest $request): PirepResource
*/
public function file(string $pirep_id, FileRequest $request): PirepResource
{
Log::info('PIREP file, user '.Auth::id(), $request->post());
Log::info('PIREP File, pirep_id: '.$pirep_id.', user_id: '.Auth::id());

/** @var User $user */
$user = Auth::user();
Expand Down Expand Up @@ -350,7 +346,7 @@ public function file(string $pirep_id, FileRequest $request): PirepResource
*/
public function cancel(string $pirep_id, Request $request)
{
Log::info('PIREP '.$pirep_id.' Cancel, user '.Auth::id(), $request->post());
Log::info('PIREP Cancel, pirep_id: '.$pirep_id.', user_id: '.Auth::id());

$pirep = Pirep::find($pirep_id);
if (!empty($pirep)) {
Expand Down Expand Up @@ -502,7 +498,7 @@ public function route_post(string $id, RouteRequest $request): JsonResponse
$pirep = Pirep::find($id);
$this->checkCancelled($pirep);

Log::info('Posting ROUTE, PIREP: '.$id, $request->post());
Log::info('Posting ROUTE, pirep_id: '.$id);

// Delete the route before posting a new one
Acars::where([
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Casts/CommaDelimitedCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CommaDelimitedCast implements CastsAttributes
*/
public function get($model, string $key, $value, array $attributes)
{
if (empty(trim($value))) {
if (empty($value) || empty(trim($value))) {
return [];
}

Expand Down
12 changes: 11 additions & 1 deletion app/Models/Rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,17 @@ class Rank extends Model
public function imageUrl(): Attribute
{
return Attribute::make(
get: fn ($value) => str_contains($value, 'http') ? $value : (filled($value) ? public_url($value) : null),
get: function ($value) {
if (!filled($value)) {
return null;
}

if (str_contains($value, 'http')) {
return $value;
}

return public_url($value);
},
);
}

Expand Down
4 changes: 3 additions & 1 deletion app/Notifications/NotificationEventsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ public function onPirepFile(PirepFiled $event): void
/*
* Broadcast notifications
*/
Notification::send([$event->pirep], new Messages\Broadcast\PirepFiled($event->pirep));
if (setting('notifications.discord_pirep_filed', true)) {
Notification::send([$event->pirep], new Messages\Broadcast\PirepFiled($event->pirep));
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Services/PirepService.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ public function submit(Pirep $pirep)
}
}

Log::info('New PIREP filed', [$pirep]);
Log::info('New PIREP filed, pirep_id: '.$pirep->id);
event(new PirepFiled($pirep));

$pirep->refresh();
Expand Down
2 changes: 2 additions & 0 deletions app/Support/ThemeViewFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class ThemeViewFinder extends \Igaster\LaravelTheme\themeViewFinder
{
protected $themeEngine;

public function __construct(Filesystem $files, array $paths, array $extensions = null)
{
//$this->themeEngine = \App::make('igaster.themes');
Expand Down
2 changes: 1 addition & 1 deletion app/Support/Timezonelist.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Timezonelist
public static function formatTimezone($timezone, $continent, $htmlencode = true)
{
try {
$time = new \DateTimeImmutable(null, new DateTimeZone($timezone));
$time = new \DateTimeImmutable('now', new DateTimeZone($timezone));
} catch (\Exception $e) {
Log::error($e->getMessage());
return '';
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"psr/container": "1.1.1",
"composer/composer": "~2.6.5",
"composer/installers": "~1.12.0",
"laravel/framework": "~v10.0",
"laravel/framework": "~v10.22",
"arrilot/laravel-widgets": "~3.13.0",
"doctrine/dbal": "^3.0",
"guzzlehttp/guzzle": "~7.4.1",
"hashids/hashids": "~4.1.0",
"igaster/laravel-theme": "dev-master",
"intervention/image": "~2.4",
"jmikola/geojson": "1.0.*",
"jmikola/geojson": "^1.2.0",
"joshbrw/laravel-module-installer": "~2.0.1",
"laracasts/flash": "~3.2.2",
"laravel/helpers": "~v1.6.0",
Expand All @@ -63,7 +63,7 @@
"php-units-of-measure/php-units-of-measure": "~2.1.0",
"phpvms/sample-module": "~1.0",
"prettus/l5-repository": "~2.9.0",
"santigarcor/laratrust": "^8.0",
"santigarcor/laratrust": "^8.2.2",
"semver/semver": "~1.1.0",
"spatie/valuestore": "~1.3.2",
"tivie/php-os-detector": "~1.1.0",
Expand Down Expand Up @@ -92,12 +92,11 @@
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.8.1",
"filp/whoops": "~2.14.5",
"filp/whoops": "^2.15.3",
"friendsofphp/php-cs-fixer": "^3.17.0",
"mockery/mockery": "^1.5.0",
"nunomaduro/collision": "^v6.1.0",
"phpunit/phpunit": "~9.5.14",
"sempro/phpunit-pretty-print": "^1.4.0",
"nunomaduro/collision": "^v7.5.0",
"phpunit/phpunit": "^10.5",
"laravel/sail": "^1.23"
},
"autoload": {
Expand Down Expand Up @@ -143,7 +142,7 @@
"@php artisan package:discover --ansi",
"@php artisan phpvms:caches"
],
"test": "phpunit --verbose"
"test": "phpunit"
},
"config": {
"bin-dir": "vendor/bin/",
Expand Down
Loading

0 comments on commit c0774c3

Please sign in to comment.