Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
npm-debug.log
yarn-error.log
yarn.lock
pnpm-lock.yml
/vendor
composer.phar

Expand Down
25 changes: 25 additions & 0 deletions app/Actions/User/UpdateUserProfileAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Actions\User;

use App\Events\EmailAddressWasChanged;
use App\Models\User;

final class UpdateUserProfileAction
{
public function execute(array $data, User $user, string $currentUserEmail): User
{
$user->update($data);

if ($user->email !== $currentUserEmail) {
$user->email_verified_at = null;
$user->save();

event(new EmailAddressWasChanged($user));
}

return $user;
}
}
35 changes: 35 additions & 0 deletions app/Console/Commands/UpdateUserSocialAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace App\Console\Commands;

use App\Models\User;
use App\Traits\FormatSocialAccount;
use Illuminate\Console\Command;

final class UpdateUserSocialAccount extends Command
{
use FormatSocialAccount;

protected $signature = 'lcm:update-user-social-account';

protected $description = 'Update user social account to normal format';

public function handle(): void
{
$this->info('Start updating users social account...');

foreach (User::verifiedUsers()->get() as $user) {
$this->info('Updating '.$user->username.'...');
$user->update([
'twitter_profile' => $this->formatTwitterHandle($user->twitter_profile),
'github_profile' => $this->formatGithubHandle($user->github_profile),
'linkedin_profile' => $this->formatLinkedinHandle($user->linkedin_profile),
]);
$this->line('');
}

$this->info('All done!');
}
}
16 changes: 0 additions & 16 deletions app/Http/Controllers/Cpanel/AnalyticsController.php

This file was deleted.

25 changes: 0 additions & 25 deletions app/Http/Controllers/Cpanel/DashboardController.php

This file was deleted.

19 changes: 0 additions & 19 deletions app/Http/Controllers/Cpanel/UserController.php

This file was deleted.

4 changes: 3 additions & 1 deletion app/Http/Controllers/NotchPayCallBackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
use NotchPay\Exceptions\ApiException;
use NotchPay\NotchPay;
use NotchPay\Payment;

Expand Down Expand Up @@ -40,6 +41,7 @@ public function __invoke(Request $request): RedirectResponse
} else {
// @ToDO Envoie de mail de notification de remerciement pour le sponsoring si l'utilisateur est dans la base de données
event(new SponsoringPaymentInitialize($transaction));

Cache::forget(key: 'sponsors');

session()->flash(
Expand All @@ -48,7 +50,7 @@ public function __invoke(Request $request): RedirectResponse
);
}

} catch (\NotchPay\Exceptions\ApiException $e) {
} catch (ApiException $e) {
Log::error($e->getMessage());
session()->flash(
key: 'error',
Expand Down
7 changes: 5 additions & 2 deletions app/Http/Controllers/ReplyAbleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

final class ReplyAbleController extends Controller
{
public function redirect(int $id, string $type): RedirectResponse
public function __invoke(int $id, string $type): RedirectResponse
{
$reply = Reply::where('replyable_id', $id)->where('replyable_type', $type)->firstOrFail();
$reply = Reply::query()
->where('replyable_id', $id)
->where('replyable_type', $type)
->firstOrFail();

return redirect(route_to_reply_able($reply->replyAble));
}
Expand Down
7 changes: 5 additions & 2 deletions app/Http/Controllers/SubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function unsubscribe(Subscribe $subscription): RedirectResponse
/** @var \App\Models\Thread $thread */
$thread = $subscription->subscribeAble;

$thread->subscribes()->where('user_id', $subscription->user->id)->delete(); // @phpstan-ignore-line
$thread->subscribes()->where('user_id', $subscription->user->id)->delete();

session()->flash('status', __('Vous êtes maintenant désabonné de ce sujet.'));

Expand All @@ -23,7 +23,10 @@ public function unsubscribe(Subscribe $subscription): RedirectResponse

public function redirect(int $id, string $type): RedirectResponse
{
$subscribe = Subscribe::where('subscribeable_id', $id)->where('subscribeable_type', $type)->firstOrFail();
$subscribe = Subscribe::query()
->where('subscribeable_id', $id)
->where('subscribeable_type', $type)
->firstOrFail();

return redirect(route_to_reply_able($subscribe->subscribeAble));
}
Expand Down
53 changes: 0 additions & 53 deletions app/Http/Controllers/User/ProfileController.php

This file was deleted.

94 changes: 0 additions & 94 deletions app/Http/Controllers/User/SettingController.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Http/Requests/UpdateProfileRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function rules(): array
return [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users,email,'.Auth::id(),
'username' => 'required|alpha_dash|max:255|unique:users,username,'.Auth::id(),
'username' => 'required|alpha_dash|max:30|unique:users,username,'.Auth::id(),
'twitter_profile' => 'max:255|nullable|unique:users,twitter_profile,'.Auth::id(),
'github_profile' => 'max:255|nullable|unique:users,github_profile,'.Auth::id(),
'bio' => 'nullable|max:160',
Expand Down
22 changes: 22 additions & 0 deletions app/Livewire/Components/User/Activities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Livewire\Components\User;

use App\Models\Activity;
use App\Models\User;
use Illuminate\Contracts\View\View;
use Livewire\Component;

final class Activities extends Component
{
public User $user;

public function render(): View
{
return view('livewire.components.user.activities', [
'activities' => Activity::latestFeed($this->user),
]);
}
}
Loading
Loading