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
)

View File

@@ -26,14 +26,16 @@ return new class extends Migration
$table->dropColumn('public_flags');
$table->dropColumn('verified');
$table->dropColumn('mfa_enabled');
$table->dropColumn('global_name');
$table->dropColumn('locale');
});
// Change & Add Columns
Schema::table('users', function (Blueprint $table) {
// Rename
$table->renameColumn('username', 'name');
$table->renameColumn('global_name', 'discord_name');
$table->renameColumn('avatar', 'discord_avatar');
$table->string('avatar')->nullable()->after('email');
// Re-Add Email verification
$table->timestamp('email_verified_at')->nullable()->after('email');

View File

@@ -97,7 +97,7 @@
@if (Auth::user()->discord_avatar)
<img class="h-8 w-8 rounded-full object-cover mr-2"
src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ Auth::user()->discord_id }}/{{ Auth::user()->discord_avatar }}.webp"
alt="{{ Auth::user()->getUserName() }}" />
alt="{{ Auth::user()->name }}" />
@endif
@else
<img class="h-8 w-8 rounded-full object-cover mr-2" src="/images/default-avatar.webp"
@@ -106,7 +106,7 @@
@auth
<div style="display: flex; flex-direction: row; align-items: flex-start;">
{{ Auth::user()->getUserName() }}
{{ Auth::user()->name }}
@if ($notAvailable)
<i class="fa-solid fa-bell text-rose-600"></i>
@endif
@@ -234,7 +234,7 @@
@if (Auth::user()->discord_avatar)
<img class="h-8 w-8 rounded-full object-cover mr-2"
src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ Auth::user()->discord_id }}/{{ Auth::user()->discord_avatar }}.webp"
alt="{{ Auth::user()->getUserName() }}" />
alt="{{ Auth::user()->name }}" />
@else
<img class="h-8 w-8 rounded-full object-cover mr-2" src="/images/default-avatar.webp"
alt="Guest" />

View File

@@ -60,7 +60,7 @@
{{ $user->id }}
</th>
<td class="px-6 py-4">
{{ $user->discord_name ?? $user->name }}
{{ $user->name }}
</td>
<td class="px-6 py-4">
{{ $user->is_patreon ? 'Yes' : 'No' }}

View File

@@ -7,17 +7,17 @@
@php $user = cache()->rememberForever('commentUser'.$comment->commenter_id, fn () => \App\Models\User::where('id', $comment->commenter_id)->first()); @endphp
<div>
@if($user->discord_avatar)
<img class="w-16 h-16 rounded-full m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $user->discord_id }}/{{ $user->discord_avatar }}.webp" alt="{{ $user->discord_name ?? $user->name }} Avatar">
<img class="w-16 h-16 rounded-full m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $user->discord_id }}/{{ $user->discord_avatar }}.webp" alt="{{ $user->name }} Avatar">
@else
<img class="w-16 h-16 rounded-full m-2" src="/images/default-avatar.webp" alt="{{ $user->discord_name ?? $user->name }} Avatar">
<img class="w-16 h-16 rounded-full m-2" src="/images/default-avatar.webp" alt="{{ $user->name }} Avatar">
@endif
</div>
<div class="text-gray-800 dark:text-gray-200">
<div>
@if($user->is_patreon)
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->discord_name ?? $user->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
@else
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->discord_name ?? $user->name }} <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->name }} <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
@endif
</div>
<div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>

View File

@@ -23,14 +23,6 @@
<x-input-error class="mt-2" :messages="$errors->get('name')" />
</div>
@if (Auth::user()->discord_name)
<div>
<x-input-label for="discord_name" :value="__('Discord Name')" />
<x-text-input id="discord_name" name="discord_name" type="text" class="mt-1 block w-full" :value="old('discord_name', $user->discord_name)" required autocomplete="discord_name" disabled />
<x-input-error class="mt-2" :messages="$errors->get('discord_name')" />
</div>
@endif
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" name="email" type="email" class="mt-1 block w-full" :value="old('email', $user->email)" required autocomplete="email" disabled />

View File

@@ -22,7 +22,7 @@
}
@endphp
<p class="text-neutral-800 dark:text-neutral-300">
{{ $playlist->user->discord_name ?? $playlist->user->name }} {{ $currentIndex + 1 }}/{{ $episodeCount }} Episodes
{{ $playlist->user->name }} {{ $currentIndex + 1 }}/{{ $episodeCount }} Episodes
</p>
</div>

View File

@@ -8,7 +8,7 @@
@endif
<div class="flex flex-col py-5 pl-24">
<strong class="text-slate-900 text-xl font-bold dark:text-slate-200">
{{ $user->discord_name ?? $user->name }}
{{ $user->name }}
@if ($user->is_patreon)
<a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i
class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a>

View File

@@ -9,18 +9,18 @@
<div class="contents">
@if($comment->commenter->discord_avatar)
<img class="w-12 h-12 rounded-lg m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $comment->commenter->discord_id }}/{{ $comment->commenter->discord_avatar }}.webp" alt="{{ $comment->commenter->discord_name ?? $comment->commenter->name }} Avatar">
<img class="w-12 h-12 rounded-lg m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $comment->commenter->discord_id }}/{{ $comment->commenter->discord_avatar }}.webp" alt="{{ $comment->commenter->name }} Avatar">
@else
<img class="w-12 h-12 rounded-lg m-2" src="/images/default-avatar.webp" alt="{{ $comment->commenter->discord_name ?? $comment->commenter->name }} Avatar">
<img class="w-12 h-12 rounded-lg m-2" src="/images/default-avatar.webp" alt="{{ $comment->commenter->name }} Avatar">
@endif
</div>
<div class="text-gray-800 dark:text-gray-200">
<div>
@if($comment->commenter->is_patreon)
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->discord_name ?? $comment->commenter->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
@else
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->discord_name ?? $comment->commenter->name }} <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->name }} <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
@endif
</div>
<div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>