From 90c0466cd09358e5a355759e39cb194e3cf16630 Mon Sep 17 00:00:00 2001 From: Peter Papp Date: Tue, 6 Apr 2021 10:10:38 +0200 Subject: [PATCH 1/3] - fixed setup wizard --- app/Http/Controllers/App/SetupWizardController.php | 2 +- webpack.mix.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/App/SetupWizardController.php b/app/Http/Controllers/App/SetupWizardController.php index 1a3d6bb4..8c5f1d61 100644 --- a/app/Http/Controllers/App/SetupWizardController.php +++ b/app/Http/Controllers/App/SetupWizardController.php @@ -418,7 +418,7 @@ class SetupWizardController extends Controller $user ->settings() ->create([ - 'storage_capacity' => get_setting('storage_default'), + 'storage_capacity' => get_setting('storage_default') ?? 5, 'avatar' => store_avatar($request, 'avatar'), 'name' => $request->name, ]); diff --git a/webpack.mix.js b/webpack.mix.js index 96abd09c..17c9fe68 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -28,7 +28,7 @@ mix.js('resources/js/main.js', 'public/js') output: { chunkFilename: '[name].js?id=[chunkhash]', }, - devtool: 'inline-source-map', + //devtool: 'inline-source-map', devServer: { clientLogLevel: 'none' } @@ -38,7 +38,7 @@ mix.js('resources/js/main.js', 'public/js') host: '192.168.1.198', port: '8080' }, - }*/ + })*/ .disableNotifications(); if (mix.inProduction()) { From 131ae8109f87242c342ad6c03ccf522771883537 Mon Sep 17 00:00:00 2001 From: Peter Papp Date: Tue, 6 Apr 2021 10:27:02 +0200 Subject: [PATCH 2/3] - flush cache after language upgrade - Gateway fix - extended language editor with textarea --- .../App/AppFunctionsController.php | 1 - app/Http/Controllers/App/Maintenance.php | 23 ++++++++++------- app/Services/LanguageService.php | 3 +++ .../js/views/Admin/Languages/Language.vue | 25 +++++++++++++++---- 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/App/AppFunctionsController.php b/app/Http/Controllers/App/AppFunctionsController.php index 6ffb93a7..2087d1c2 100644 --- a/app/Http/Controllers/App/AppFunctionsController.php +++ b/app/Http/Controllers/App/AppFunctionsController.php @@ -27,7 +27,6 @@ class AppFunctionsController extends Controller * @var array */ private $blacklist = [ - 'contact_email', 'purchase_code', 'license', ]; diff --git a/app/Http/Controllers/App/Maintenance.php b/app/Http/Controllers/App/Maintenance.php index ecbc6c4a..6bc28675 100644 --- a/app/Http/Controllers/App/Maintenance.php +++ b/app/Http/Controllers/App/Maintenance.php @@ -17,20 +17,14 @@ use Schema; class Maintenance extends Controller { - /** - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function __construct() - { - // Check admin permission - Gate::authorize('maintenance'); - } - /** * Start maintenance mode */ public function up() { + // Check admin permission + Gate::authorize('maintenance'); + $command = Artisan::call('up'); if ($command === 0) { @@ -43,6 +37,9 @@ class Maintenance extends Controller */ public function down() { + // Check admin permission + Gate::authorize('maintenance'); + $command = Artisan::call('down'); if ($command === 0) { @@ -58,9 +55,14 @@ class Maintenance extends Controller */ public function upgrade_translations() { + // Check admin permission + Gate::authorize('maintenance'); + resolve(LanguageService::class) ->upgrade_language_translations(); + + return response('Done.', 201); } @@ -69,6 +71,9 @@ class Maintenance extends Controller */ public function upgrade_database() { + // Check admin permission + Gate::authorize('maintenance'); + $command = Artisan::call('migrate', [ '--force' => true ]); diff --git a/app/Services/LanguageService.php b/app/Services/LanguageService.php index 2bf192ff..9eead415 100644 --- a/app/Services/LanguageService.php +++ b/app/Services/LanguageService.php @@ -88,6 +88,9 @@ class LanguageService // Store translations into database DB::table('language_translations') ->insert($translations); + + // Flush cache + cache()->forget("language-translations-$locale"); }); } } \ No newline at end of file diff --git a/resources/js/views/Admin/Languages/Language.vue b/resources/js/views/Admin/Languages/Language.vue index da80c8e4..41eccea7 100644 --- a/resources/js/views/Admin/Languages/Language.vue +++ b/resources/js/views/Admin/Languages/Language.vue @@ -97,12 +97,27 @@
- + + + + + {{ errors[0] }}
From e40ddbec1479bd5972671ffa4c20ffb107e62a67 Mon Sep 17 00:00:00 2001 From: Peter Papp Date: Tue, 6 Apr 2021 10:40:51 +0200 Subject: [PATCH 3/3] fixed upgrade_language_translations --- app/Services/LanguageService.php | 2 +- tests/Feature/App/AppUpgradeTest.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Services/LanguageService.php b/app/Services/LanguageService.php index 9eead415..e85ddab4 100644 --- a/app/Services/LanguageService.php +++ b/app/Services/LanguageService.php @@ -71,7 +71,7 @@ class LanguageService // Find new translations in default translations $newbies = $default_translations[$license] - ->diff(map_language_translations($translations)); + ->diffKeys(map_language_translations($translations)); // Store new translations for every language $locales->each(function ($locale) use ($newbies) { diff --git a/tests/Feature/App/AppUpgradeTest.php b/tests/Feature/App/AppUpgradeTest.php index 0130373b..0fef2a82 100644 --- a/tests/Feature/App/AppUpgradeTest.php +++ b/tests/Feature/App/AppUpgradeTest.php @@ -2,6 +2,7 @@ namespace Tests\Feature\App; +use App\Models\LanguageTranslation; use App\Models\User; use DB; use Illuminate\Foundation\Testing\DatabaseMigrations; @@ -58,7 +59,7 @@ class AppUpgradeTest extends TestCase 'lang' => $locale ], [ 'key' => 'activation.stripe.description', - 'value' => 'To charge your users, please set up your Stripe account credentials.', + 'value' => 'This is original test description', 'lang' => $locale ] ]); @@ -75,6 +76,18 @@ class AppUpgradeTest extends TestCase 'value' => 'Your Stripe account is not set', 'lang' => $locale, ]); + + $this->assertDatabaseHas('language_translations', [ + 'key' => 'activation.stripe.description', + 'value' => 'This is original test description', + 'lang' => $locale, + ]); + + $this->assertDatabaseMissing('language_translations', [ + 'key' => 'activation.stripe.description', + 'value' => 'To charge your users, please set up your Stripe account credentials.', + 'lang' => $locale, + ]); }); } }