Skip to content

MEP #305

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 25 commits into from
Jan 4, 2025
Merged

MEP #305

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0f44358
feat:[lar-163] translate page and remove unused files
cybersoldattech Dec 27, 2024
10654ce
fix:[lar-163] restore feeds file
cybersoldattech Dec 27, 2024
6cec17e
feat:[lar-163] translate page and remove unused files (#282)
cybersoldattech Dec 27, 2024
c602a48
feat:[lar-156] Add lazy loading in img
cybersoldattech Dec 30, 2024
baa04d2
feat:[lar-156] Add lazy loading in img
cybersoldattech Dec 30, 2024
082a20b
fix: (LAR-154) fixing bug when displaying user thread suscription
StevyMarlino Dec 30, 2024
e74d1f4
chore(deps): bump stefanzweifel/git-auto-commit-action from 4 to 5 (#…
dependabot[bot] Dec 30, 2024
8086d59
chore(deps): bump actions/checkout from 3 to 4 (#284)
dependabot[bot] Dec 30, 2024
441ee73
feat:[lar-156] Add lazy loading in img (#286)
cybersoldattech Dec 30, 2024
aa3ab10
fix: (LAR-154) fixing bug when displaying user thread suscription (#287)
StevyMarlino Dec 30, 2024
56b789d
feat: (LAR-157) add bulk deletion for banned user
StevyMarlino Dec 31, 2024
d9074e8
feat: [LAR-164] add filament mails logger (#288)
mckenziearts Dec 31, 2024
87133d0
feat:[lar-158] add creation date in article resouce
cybersoldattech Jan 1, 2025
b45ebac
feat: [LAR-164] add filament mails logger (#288)
mckenziearts Dec 31, 2024
5d1f6b9
feat:[lar-158] add creation date in article resource (#290)
cybersoldattech Jan 1, 2025
abf60ae
feat: [LAR-150] add forum leaderboard page (#289)
mckenziearts Jan 1, 2025
4599c9a
chore: [LAR-168] fix layout of leaderboard when user is guest (#291)
mckenziearts Jan 1, 2025
16991c1
fix: (LAR-157) fixing lint
StevyMarlino Jan 2, 2025
0b8de84
Feature/lar 157 admin rajouter un bulk banned users (#294)
StevyMarlino Jan 2, 2025
53ff277
fix: [LAR-172] article and discussion single page preview for seo (#295)
mckenziearts Jan 2, 2025
e9b058f
fix: [LAR-177] current locale bug (#299)
mckenziearts Jan 3, 2025
a1e797b
feat: update composer.lock
mckenziearts Jan 3, 2025
17ee875
Merge branch 'main' into develop
mckenziearts Jan 3, 2025
2d9791f
chore: update composer lock file
mckenziearts Jan 3, 2025
36f1939
fix:[lar-179] hash password in register and add wire loading (#304)
cybersoldattech Jan 4, 2025
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
34 changes: 33 additions & 1 deletion app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function table(Table $table): Table
->placeholder('N/A')
->date(),
Tables\Columns\TextColumn::make(name: 'created_at')
->label(__('use.inscription'))
->label(__('user.inscription'))
->date(),
])
->filters([
Expand Down Expand Up @@ -115,6 +115,38 @@ public static function table(Table $table): Table
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\BulkAction::make('delete_banned')
->label(__('Supprimer les utilisateurs bannis'))
->icon('heroicon-o-trash')
->color('danger')
->action(function ($records): void {

$bannedUsers = $records->whereNotNull('banned_at');

if ($bannedUsers->isEmpty()) {
Notification::make()
->warning()
->title(__('actions.delete_none'))
->duration(5000)
->body(__('actions.delete_none_description'))
->send();

return;
}

$bannedUsers->each(function (User $user): void {
$user->delete();
});

Notification::make()
->success()
->title(__('actions.delete_success'))
->duration(5000)
->body(__('actions.delete_success_description'))
->send();
})
->requiresConfirmation()
->deselectRecordsAfterCompletion(),
]);
}

Expand Down
2 changes: 0 additions & 2 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public function getTabs(): array
'all' => Tab::make(__('global.all')),
'banned' => Tab::make(__('global.banned'))
->modifyQueryUsing(fn ($query) => $query->isBanned()),
'unbanned' => Tab::make(__('global.unbanned'))
->modifyQueryUsing(fn ($query) => $query->isNotBanned()),
];
}
}
2 changes: 1 addition & 1 deletion app/Livewire/Components/ChangeLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class ChangeLocale extends Component
{
public string $currentLocale;
public ?string $currentLocale = null;

public function mount(): void
{
Expand Down
5 changes: 2 additions & 3 deletions app/Livewire/Pages/Articles/SinglePost.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ final class SinglePost extends Component
{
public Article $article;

public function mount(Article $article): void
public function mount(): void
{
/** @var User $user */
$user = Auth::user();

$article = $article->load(['media', 'user'])->loadCount('views');
$article = $this->article->load(['media', 'user'])->loadCount('views');

abort_unless(
$article->isPublished() || ($user && $article->isAuthoredBy($user)) || ($user && $user->hasAnyRole(['admin', 'moderator'])), // @phpstan-ignore-line
Expand All @@ -42,7 +42,6 @@ public function mount(Article $article): void
->twitterTitle($article->title)
->twitterDescription($article->excerpt(150))
->twitterImage($image)
->twitterSite('laravelcm')
->url($article->canonicalUrl());

$this->article = $article;
Expand Down
16 changes: 7 additions & 9 deletions app/Livewire/Pages/Discussions/SingleDiscussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@ final class SingleDiscussion extends Component implements HasActions, HasForms

public Discussion $discussion;

public function mount(Discussion $discussion): void
public function mount(): void
{
views($discussion)->cooldown(now()->addHours(2))->record();
views($this->discussion)->cooldown(now()->addHours(2))->record();

// @phpstan-ignore-next-line
seo()
->title($discussion->title)
->description($discussion->excerpt(100))
->title($this->discussion->title)
->description($this->discussion->excerpt(100))
->image(asset('images/socialcard.png'))
->twitterTitle($discussion->title)
->twitterDescription($discussion->excerpt(100))
->twitterImage(asset('images/socialcard.png'))
->twitterSite('laravelcm')
->twitterTitle($this->discussion->title)
->twitterDescription($this->discussion->excerpt(100))
->withUrl();

$this->discussion = $discussion->load('tags', 'replies', 'reactions', 'replies.user');
$this->discussion->load('tags', 'replies', 'reactions', 'replies.user', 'user');
}

public function editAction(): Action
Expand Down
8 changes: 0 additions & 8 deletions app/Livewire/Pages/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ public function render(): View
{
$ttl = now()->addDays(2);

// @phpstan-ignore-next-line
seo()
->description(__('pages/home.description'))
->twitterDescription(__('pages/home.description'))
->image(asset('/images/socialcard.png'))
->twitterSite('laravelcm')
->withUrl();

return view('livewire.pages.home', [
'plans' => Cache::remember(
key: 'plans',
Expand Down
4 changes: 4 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ final class User extends Authenticatable implements FilamentUser, HasAvatar, Has
'last_active_at' => 'datetime',
];

protected $with = [
'providers',
];

public function hasProvider(string $provider): bool
{
foreach ($this->providers as $p) {
Expand Down
10 changes: 10 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ public function boot(): void
$this->bootEloquentMorphs();
$this->bootFilament();

// @phpstan-ignore-next-line
seo()
->title(
default: __('pages/home.title'),
modify: fn (string $title) => $title.' | '.__('global.site_name')
)
->description(default: __('global.site_description'))
->image(default: fn () => asset('images/socialcard.png'))
->twitterSite('@laravelcm');

FilamentColor::register([
'primary' => Color::Emerald,
'danger' => Color::Red,
Expand Down
4 changes: 2 additions & 2 deletions app/View/Composers/InactiveDiscussionsComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function compose(View $view): void
{
$discussions = Cache::remember(
key: 'inactive_discussions',
ttl: now()->addDays(3),
callback: fn () => Discussion::noComments()->limit(5)->get()
ttl: now()->addWeek(),
callback: fn () => Discussion::with('user')->noComments()->limit(5)->get()
);

$view->with('discussions', $discussions);
Expand Down
4 changes: 2 additions & 2 deletions app/View/Composers/TopContributorsComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public function compose(View $view): void
$topContributors = Cache::remember(
key: 'contributors',
ttl: now()->addWeek(),
callback: fn () => User::topContributors()
callback: fn () => User::query()->scopes('topContributors')
->get()
->filter(fn (User $contributor) => $contributor->loadCount('discussions')->discussions_count >= 1)
->filter(fn (User $contributor) => $contributor->discussions_count >= 1)
->take(5)
);

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ext-json": "*",
"archtechx/laravel-seo": "^0.10",
"awcodes/filament-badgeable-column": "^2.3",
"barryvdh/laravel-debugbar": "^3.14",
"blade-ui-kit/blade-heroicons": "^2.4",
"codeat3/blade-phosphor-icons": "^2.0",
"cyrildewit/eloquent-viewable": "^7.0",
Expand Down
Loading
Loading