From fb64056cbd9648016cd496579d66afbdfb317ac0 Mon Sep 17 00:00:00 2001 From: printempw Date: Sun, 1 Jan 2017 16:37:29 +0800 Subject: [PATCH] fix minor bugs caused by batch-import plugin --- app/Services/Utils.php | 6 +++--- app/helpers.php | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Services/Utils.php b/app/Services/Utils.php index b567dfe7..7c3bb65f 100644 --- a/app/Services/Utils.php +++ b/app/Services/Utils.php @@ -3,7 +3,7 @@ namespace App\Services; use Log; -use Storage; +use Storage as LaravelStorage; use App\Exceptions\PrettyPageException; class Utils @@ -47,8 +47,8 @@ class Utils if (file_exists($absolute_path)) { $hash = hash_file('sha256', $absolute_path); - if (!Storage::disk('textures')->has($hash)) { - Storage::disk('textures')->move($path, $hash); + if (!LaravelStorage::disk('textures')->has($hash)) { + LaravelStorage::disk('textures')->move($path, $hash); } else { // delete the temp file unlink($absolute_path); diff --git a/app/helpers.php b/app/helpers.php index 5c0092b7..0fac34a6 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -236,8 +236,10 @@ if (! function_exists('bs_announcement')) { if (! function_exists('bs_nickname')) { - function bs_nickname(\App\Models\User $user) + function bs_nickname(\App\Models\User $user = null) { + $user = $user ?: app('users')->getCurrentUser(); + return ($user->getNickName() == '') ? $user->email : $user->getNickName(); } }