From 147cf6db7154f272e1dd67d6fb98f971aaf44c90 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Tue, 5 Jul 2022 03:02:33 +0800 Subject: [PATCH] admin add confirm user + show original media info when not meet the standard --- .../User/UserResource/Pages/UserProfile.php | 17 +++++++++++++++++ nexus/Install/Install.php | 4 ++-- nexus/Torrent/TechnicalInformation.php | 3 ++- resources/lang/en/admin.php | 1 + resources/lang/zh_CN/admin.php | 1 + resources/lang/zh_TW/admin.php | 1 + 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/Filament/Resources/User/UserResource/Pages/UserProfile.php b/app/Filament/Resources/User/UserResource/Pages/UserProfile.php index 58ae14b4..b371a1ac 100644 --- a/app/Filament/Resources/User/UserResource/Pages/UserProfile.php +++ b/app/Filament/Resources/User/UserResource/Pages/UserProfile.php @@ -45,6 +45,9 @@ class UserProfile extends Page if ($this->record->two_step_secret) { $actions[] = $this->buildDisableTwoStepAuthenticationAction(); } + if ($this->record->status == User::STATUS_PENDING) { + $actions[] = $this->buildConfirmAction(); + } $actions[] = $this->buildResetPasswordAction(); $actions[] = $this->buildAssignExamAction(); $actions[] = $this->buildGrantMedalAction(); @@ -204,6 +207,20 @@ class UserProfile extends Page }); } + private function buildConfirmAction() + { + return Actions\Action::make(__('admin.resources.user.actions.confirm_btn')) + ->modalHeading(__('admin.resources.user.actions.confirm_btn')) + ->requiresConfirmation() + ->action(function () { + $this->record->status = User::STATUS_CONFIRMED; + $this->record->info= null; + $this->record->save(); + $this->notify('success', 'Success!'); + $this->emitSelf(self::EVENT_RECORD_UPDATED, $this->record->id); + }); + } + diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 7db375b6..52759ace 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -12,7 +12,7 @@ class Install { protected $currentStep; - protected $minimumPhpVersion = '8.0.2'; + protected $minimumPhpVersion = '8.0.3'; protected $progressKeyPrefix = '__step'; @@ -71,7 +71,7 @@ class Install for ($i = 1; $i < $step; $i++) { $progressKey = $this->getProgressKey($i); if (!isset($_SESSION[$progressKey])) { - $this->doLog("check step: $i, session doesn't have" ); + $this->doLog("check step: $i, session doesn't have: " . json_encode($_SESSION)); return false; } } diff --git a/nexus/Torrent/TechnicalInformation.php b/nexus/Torrent/TechnicalInformation.php index ad8c35cb..34cab405 100644 --- a/nexus/Torrent/TechnicalInformation.php +++ b/nexus/Torrent/TechnicalInformation.php @@ -151,7 +151,8 @@ class TechnicalInformation $subtitles = $this->getSubtitles(); // dd($videos, $audios, $subtitles); if (empty($videos) && empty($audios) && empty($subtitles)) { - return ''; +// return ''; + return sprintf('
%s
', $this->mediaInfo); } $result = ''; diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 2350deee..eeb4980d 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -50,6 +50,7 @@ return [ 'grant_medal_medal_label' => 'Select medal', 'grant_medal_duration_label' => 'Duration', 'grant_medal_duration_help' => 'Unit: days. If left blank, the user has permanent possession', + 'confirm_btn' => 'Confirm', ] ], 'exam_user' => [ diff --git a/resources/lang/zh_CN/admin.php b/resources/lang/zh_CN/admin.php index c238d925..c82431df 100644 --- a/resources/lang/zh_CN/admin.php +++ b/resources/lang/zh_CN/admin.php @@ -50,6 +50,7 @@ return [ 'grant_medal_medal_label' => '选择勋章', 'grant_medal_duration_label' => '有效时长', 'grant_medal_duration_help' => '单位:天。如果留空,用户永久拥有', + 'confirm_btn' => '确认', ] ], 'exam_user' => [ diff --git a/resources/lang/zh_TW/admin.php b/resources/lang/zh_TW/admin.php index 09512e19..664e355e 100644 --- a/resources/lang/zh_TW/admin.php +++ b/resources/lang/zh_TW/admin.php @@ -50,6 +50,7 @@ return [ 'grant_medal_medal_label' => '選擇勛章', 'grant_medal_duration_label' => '有效時長', 'grant_medal_duration_help' => '單位:天。如果留空,用戶永久擁有', + 'confirm_btn' => '確認', ] ], 'exam_user' => [