Remove nickname

This commit is contained in:
2026-01-08 16:13:43 +01:00
parent e100f3bf23
commit b1c48830c4
12 changed files with 20 additions and 50 deletions

View File

@@ -31,14 +31,13 @@ class DiscordAuthController extends Controller
$user = User::where('discord_id', $discordUser->id)->first();
if (! $user) {
if (!$user) {
// link by email if it already exists
$user = User::where('email', $discordUser->email)->first();
if ($user) {
$user->update([
'discord_id' => $discordUser->id,
'discord_name' => $discordUser->nickname ?? $discordUser->name,
'discord_avatar' => $discordUser->avatar,
]);
} else {
@@ -47,7 +46,6 @@ class DiscordAuthController extends Controller
'name' => $discordUser->name,
'email' => $discordUser->email,
'discord_id' => $discordUser->id,
'discord_name' => $discordUser->nickname ?? $discordUser->name,
'discord_avatar' => $discordUser->avatar,
'password' => bcrypt(Str::random(40)),
]);

View File

@@ -43,10 +43,7 @@ class AdminUserSearch extends Component
$users = User::when($this->filtered !== [], fn ($query) => $query->where('id', '>=', 10000))
->when($this->patreon !== [], fn ($query) => $query->where('is_patreon', 1))
->when($this->banned !== [], fn ($query) => $query->where('is_banned', 1))
->when($this->search !== '', fn ($query) => $query->where(function($query) {
$query->where('name', 'like', '%'.$this->search.'%')
->orWhere('discord_name', 'like', '%'.$this->search.'%');
}))
->when($this->search !== '', fn ($query) => $query->where('name', 'like', '%'.$this->search.'%'))
->paginate(20);
return view('livewire.admin-user-search', [

View File

@@ -29,7 +29,6 @@ class User extends Authenticatable
'is_banned',
// Discord
'discord_id',
'discord_name',
'discord_avatar',
];
@@ -60,26 +59,9 @@ class User extends Authenticatable
'tag_blacklist' => 'array',
// Discord
'discord_id' => 'integer',
'discord_name' => 'string',
'discord_avatar' => 'string',
];
/**
* Get the user name
*/
public function getUserName(): string
{
if (!$this->discord_name) {
return $this->name;
}
if ($this->discord_name == $this->name)
{
return $this->name;
}
return "{$this->name} ({$this->discord_name})";
}
/**
* Has Many Playlists.

View File

@@ -122,12 +122,11 @@ class CommentService
$url = '/hentai/' . $episode->slug . '#comment-' . $reply->id;
$user = Auth::user();
$username = $user->discord_name ?? $user->name;
$parentCommentUser = User::where('id', $comment->commenter_id)->firstOrFail();
$parentCommentUser->notify(
new CommentNotification(
"{$username} replied to your comment.",
"{$user->name} replied to your comment.",
Str::limit($reply->comment, 50),
$url
)