Skip to content

🐛 fix user model not found #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Livewire/Discussions/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getCommentsProperty(): Collection
{
$replies = collect();

foreach ($this->discussion->replies->load(['allChildReplies', 'author']) as $reply) {
foreach ($this->discussion->replies->load(['allChildReplies', 'user']) as $reply) {
/** @var Reply $reply */
if ($reply->allChildReplies->isNotEmpty()) {
foreach ($reply->allChildReplies as $childReply) {
Expand Down
10 changes: 5 additions & 5 deletions app/Http/Livewire/MarkdownX.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ public function getTrendingPeoples(array $payload): void
->get()
->map(
function (User $user) {
$people['name'] = $user->name;
$people['picture'] = $user->profile_photo_url;
$people['username'] = $user->username;
return $people;
}
$people['name'] = $user->name;
$people['picture'] = $user->profile_photo_url;
$people['username'] = $user->username;
return $people;
}
);

$this->dispatchBrowserEvent('markdown-x-peoples-results', [
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Middleware/HttpsProtocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class HttpsProtocol
{
public function handle(Request $request, Closure $next): RedirectResponse
public function handle(Request $request, Closure $next): RedirectResponse | Response | JsonResponse
{
if (app()->environment('production') && ! $request->isSecure()) {
return redirect()->secure($request->getRequestUri());
Expand Down
1 change: 0 additions & 1 deletion app/Listeners/SendNewCommentNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace App\Listeners;

use App\Events\CommentWasAdded;
use App\Models\Discussion;
use App\Models\Subscribe;
use App\Models\User;
use App\Notifications\NewCommentNotification;
Expand Down
1,530 changes: 782 additions & 748 deletions helpers/ModelHelper.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions resources/views/components/forum/thread.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-skin-
@can(App\Policies\ThreadPolicy::DELETE, $thread)
<button type="button" onclick="Livewire.emit('openModal', 'modals.delete-thread', {{ json_encode([$thread->id]) }})" class="group text-skin-inverted-muted flex px-4 py-2 text-sm hover:text-skin-inverted" role="menuitem" tabindex="-1">
<x-heroicon-s-trash class="mr-3 h-5 w-5 text-skin-muted group-hover:text-skin-base" />
<span>Supprimer</span>
<span>{{ __('Supprimer') }}</span>
</button>
@endcan
<a href="#" class="group text-skin-inverted-muted flex px-4 py-2 text-sm hover:text-skin-inverted" role="menuitem" tabindex="-1">
<x-heroicon-s-flag class="mr-3 h-5 w-5 text-skin-muted group-hover:text-skin-base" />
<span>Signaler contenu</span>
<span>{{ __('Signaler contenu') }}</span>
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/user/status.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-md text-sm font-medium bg-green-500 bg-opacity-10 text-green-500 font-sans">
Modérateur
{{ __('Modérateur') }}
</span>
12 changes: 8 additions & 4 deletions resources/views/discussions/_contributions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@
@foreach($discussions as $discussion)
<li class="py-4">
<div class="flex space-x-3">
<img class="h-6 w-6 object-cover rounded-full" src="{{ $discussion->author->profile_photo_url }}" alt="">
<img class="h-6 w-6 object-cover rounded-full" src="{{ $discussion->user->profile_photo_url }}" alt="">
<div class="flex-1 space-y-1">
<div class="flex items-center justify-between">
<h3 class="text-sm font-medium text-skin-inverted font-sans">
<a href="{{ route('profile', $discussion->author->username) }}" class="hover:underline">{{ $discussion->author->name }}</a>
<a href="{{ route('profile', $discussion->user->username) }}" class="hover:underline">{{ $discussion->user->name }}</a>
</h3>
<p class="text-xs text-skin-muted font-normal truncate"><time-ago time="{{ $discussion->created_at->getTimestamp() }}" /></p>
<p class="text-xs text-skin-muted font-normal truncate">
<time-ago time="{{ $discussion->created_at->getTimestamp() }}" />
</p>
</div>
<a href="{{ route('discussions.show', $discussion) }}" class="inline-flex text-sm text-skin-base font-normal hover:text-skin-inverted leading-5">{{ $discussion->title }}</a>
<a href="{{ route('discussions.show', $discussion) }}" class="inline-flex text-sm text-skin-base font-normal hover:text-skin-inverted leading-5">
{{ $discussion->title }}
</a>
</div>
</div>
</li>
Expand Down
20 changes: 11 additions & 9 deletions resources/views/discussions/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
<div class="relative sm:flex sm:space-x-3">
<div class="flex items-center sm:items-start">
<div class="relative">
<img class="h-10 w-10 object-cover rounded-full bg-skin-card-gray ring-8 ring-body" src="{{ $discussion->author->profile_photo_url }}" alt="{{ $discussion->author->name }}">
<img class="h-10 w-10 object-cover rounded-full bg-skin-card-gray ring-8 ring-body" src="{{ $discussion->user->profile_photo_url }}" alt="{{ $discussion->user->name }}">
<span class="absolute top-5 -right-1 bg-skin-body rounded-tl px-0.5 py-px">
<svg class="h-5 w-5 text-skin-muted" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
<path fill-rule="evenodd" d="M12 2.25c-2.429 0-4.817.178-7.152.521C2.87 3.061 1.5 4.795 1.5 6.741v6.018c0 1.946 1.37 3.68 3.348 3.97.877.129 1.761.234 2.652.316V21a.75.75 0 001.28.53l4.184-4.183a.39.39 0 01.266-.112c2.006-.05 3.982-.22 5.922-.506 1.978-.29 3.348-2.023 3.348-3.97V6.741c0-1.947-1.37-3.68-3.348-3.97A49.145 49.145 0 0012 2.25zM8.25 8.625a1.125 1.125 0 100 2.25 1.125 1.125 0 000-2.25zm2.625 1.125a1.125 1.125 0 112.25 0 1.125 1.125 0 01-2.25 0zm4.875-1.125a1.125 1.125 0 100 2.25 1.125 1.125 0 000-2.25z" clip-rule="evenodd" />
</svg>
</span>
</div>
<div class="ml-4 sm:hidden">
<a href="{{ route('profile', $discussion->author->username) }}">
<a href="{{ route('profile', $discussion->user->username) }}">
<h4 class="inline-flex items-center text-sm text-skin-inverted font-medium">
{{ $discussion->author->name }}
@if($discussion->author->hasAnyRole('admin', 'moderator'))
{{ $discussion->user->name }}
@if($discussion->user->hasAnyRole('admin', 'moderator'))
<x-user.status />
@endif
</h4>
Expand All @@ -50,17 +50,19 @@
</div>
<div class="min-w-0 flex-1">
<div class="hidden sm:block">
<a href="{{ route('profile', $discussion->author->username) }}">
<a href="{{ route('profile', $discussion->user->username) }}">
<h4 class="inline-flex items-center text-sm text-skin-inverted font-medium">
{{ $discussion->author->name }}
@if($discussion->author->hasAnyRole('admin', 'moderator'))
{{ $discussion->user->name }}
@if($discussion->user->hasAnyRole('admin', 'moderator'))
<x-user.status />
@endif
</h4>
</a>
<div class="text-sm whitespace-nowrap text-skin-muted font-normal">
<time class="sr-only" datetime="{{ $discussion->created_at->format('Y-m-d') }}">{{ $discussion->created_at->diffForHumans() }}</time>
Crée <time-ago time="{{ $discussion->created_at->getTimestamp() }}"/>
<time class="sr-only" datetime="{{ $discussion->created_at->format('Y-m-d') }}">
{{ $discussion->created_at->diffForHumans() }}
</time>
{{ __('Crée') }} <time-ago time="{{ $discussion->created_at->getTimestamp() }}"/>
</div>
</div>
<x-markdown-content class="mt-3 text-sm prose md:prose-lg prose-green text-skin-base mx-auto max-w-none" :content="$discussion->body" />
Expand Down
32 changes: 17 additions & 15 deletions resources/views/forum/thread.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
<div class="hidden relative lg:block lg:col-span-2">
<x-sticky-content class="space-y-6">
<x-button :link="route('forum.new')" class="w-full flex justify-center">
Nouveau Sujet
{{ __('Nouveau Sujet') }}
<x-heroicon-o-plus-circle class="h-4 w-4 ml-2.5" />
</x-button>
<nav>
<a href="{{ route('forum.index') }}" class="w-full inline-flex items-center text-skin-base hover:text-skin-inverted py-3 text-sm font-medium">
<x-heroicon-s-menu class="h-5 w-5 mr-2" />
<span>Tous les sujets</span>
<span>{{ __('Tous les sujets') }}</span>
</a>
</nav>

@auth
<livewire:forum.subscribe :thread="$thread" />
@endauth

<x-forum.thread-author :author="$thread->author" />
<x-forum.thread-author :author="$thread->user" />
</x-sticky-content>
</div>
<div class="lg:col-span-7 lg:pl-8 lg:border-l lg:border-skin-base">
Expand All @@ -32,17 +32,17 @@
<div class="border-b pt-2 pb-4 border-skin-base">
<div class="sm:inline-flex sm:items-center text-sm text-skin-inverted-muted">
<div class="flex items-center">
<a href="{{ route('profile', $thread->author->username) }}" class="inline-flex items-center hover:underline">
<img class="inline-block rounded-full h-5 w-5 mr-1" src="{{ $thread->author->profile_photo_url }}" alt="Avatar de {{ $thread->author->username }}">
<span class="font-sans">{{ '@' . $thread->author->username }}</span>
<a href="{{ route('profile', $thread->user->username) }}" class="inline-flex items-center hover:underline">
<img class="inline-block rounded-full h-5 w-5 mr-1" src="{{ $thread->user->profile_photo_url }}" alt="Avatar de {{ $thread->user->username }}">
<span class="font-sans">{{ '@' . $thread->user->username }}</span>
</a>
<x-user.points :author="$thread->author" />
<x-user.points :author="$thread->user" />
<span class="inline-flex mx-1.5 space-x-1">
<span>a posé</span>
<span>{{ __('a posé') }}</span>
<time-ago time="{{ $thread->created_at->getTimestamp() }}"/>
<time class="sr-only" datetime="{{ $thread->created_at }}" title="{{ $thread->last_posted_at->format('j M, Y \à H:i') }}">{{ $thread->last_posted_at->format('j M, Y \à H:i') }}</time>
</span>
<span>dans</span>
<span>{{ __('dans') }}</span>
</div>
<div class="mt-2 sm:mt-0 sm:ml-2 self-center flex items-center space-x-2">
<div class="shrink-0">
Expand All @@ -61,7 +61,7 @@
<span class="text-skin-muted mx-2">•</span>
<span class="inline-flex items-center gap-x-2 font-medium text-green-500">
<x-heroicon-s-badge-check class="w-5 h-5" />
<span>Résolu</span>
<span>{{ __('Résolu') }}</span>
</span>
</div>
@endif
Expand All @@ -87,11 +87,11 @@
@if ($thread->isConversationOld())
<x-info-panel class="font-sans">
<p class="text-sm text-blue-700">
La dernière réponse à ce sujet remonte à plus de six mois. Pensez à ouvrir un nouveau sujet si vous avez une question similaire.
{{ __('La dernière réponse à ce sujet remonte à plus de six mois. Pensez à ouvrir un nouveau sujet si vous avez une question similaire.') }}
</p>
<p class="mt-4 text-sm">
<a href="{{ route('forum.new') }}" class="whitespace-nowrap bg-blue-100 rounded-md px-3 py-2 border border-transparent font-medium text-blue-700 hover:text-blue-600 focus:ring-2 focus:ring-offset-2 focus:ring-offset-blue-50 focus:ring-blue-600">
Créer un nouveau sujet <span aria-hidden="true">&rarr;</span>
{{ __('Créer un nouveau sujet') }} <span aria-hidden="true">&rarr;</span>
</a>
</p>
</x-info-panel>
Expand All @@ -103,16 +103,18 @@
@else
@guest
<p class="text-center py-8 font-sans text-skin-base">
Veuillez vous <a href="{{ route('login') }}" class="text-skin-primary hover:text-skin-primary-hover hover:underline">connecter</a> ou <a href="{{ route('register') }}" class="text-skin-primary hover:text-skin-primary-hover hover:underline">créer un compte</a> pour participer à cette conversation.
{{ __('Veuillez vous') }} <a href="{{ route('login') }}" class="text-skin-primary hover:text-skin-primary-hover hover:underline">{{ __('connecter') }}</a> {{ __('ou') }}
<a href="{{ route('register') }}" class="text-skin-primary hover:text-skin-primary-hover hover:underline">{{ __('créer un compte') }}</a>
{{ __('pour participer à cette conversation.') }}
</p>
@else
<div class="mt-10 flex justify-between items-center gap-x-12 text-skin-base">
<p>Vous devrez vérifier votre compte avant de participer à cette conversation.</p>
<p>{{ __('Vous devrez vérifier votre compte avant de participer à cette conversation.') }}</p>

<form action="{{ route('verification.send') }}" method="POST" class="block">
@csrf
<x-button type="submit" class="px-3 py-2 text-sm leading-4">
Recevoir un lien
{{ __('Recevoir un lien') }}
<x-heroicon-o-arrow-narrow-right class="h-5 w-5 ml-1.5" />
</x-button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/discussions/browse.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class="relative lg:col-span-7"
aria-current="{{ $selectedSortBy === 'recent' ? 'page' : 'false' }}"
class="w-full {{ $selectedSortBy === 'recent' ? 'text-skin-inverted': 'text-skin-base hover:text-skin-inverted' }} rounded-l-lg group relative min-w-0 flex-1 overflow-hidden bg-skin-card py-4 px-6 text-sm font-medium text-center hover:bg-skin-card-muted focus:z-10"
>
<span>Récent</span>
<span>{{ __('Récent') }}</span>
<span aria-hidden="true" class="{{ $selectedSortBy === 'recent' ? 'bg-skin-primary': 'bg-transparent' }} absolute inset-x-0 bottom-0 h-0.5"></span>
</button>

Expand Down
Loading