From 9ddafbad8acdd5a37bb52fc5390993797d60598b Mon Sep 17 00:00:00 2001 From: lgb <353856593@qq.com> Date: Mon, 1 May 2023 13:13:53 +0800 Subject: [PATCH] Fix BaseReps handleAnomymous --- app/Repositories/BaseRepository.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 22235cc6..68736800 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -20,8 +20,11 @@ class BaseRepository return [$field, $type]; } - protected function handleAnonymous($username, User $user, User $authenticator, Torrent $torrent = null) + protected function handleAnonymous($username, $user, User $authenticator, Torrent $torrent = null) { + if (!$user) { + return ""; + } if($user->privacy == "strong" || ($torrent && $torrent->anonymous == 'yes' && $user->id == $torrent->owner)) { //用户强私密,或者种子作者匿名而当前项作者刚好为种子作者 $anonymousText = nexus_trans('label.anonymous');