Skip to content

Commit

Permalink
Fire delete event for User & small design improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMicky-FR committed Aug 7, 2022
1 parent 1f9238b commit 8706d79
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 45 deletions.
17 changes: 10 additions & 7 deletions app/Games/Steam/SteamGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,19 @@ public function trans(string $key, array $placeholders = [])

public function getUserProfile(User $user)
{
if (empty($user->game_id)) {
$steamKey = config('services.steam.client_secret');

if (empty($user->game_id) || empty($steamKey)) {
return [];
}

return Cache::remember("users.{$user->id}.steam", now()->addMinutes(15), function () use ($user) {
return Http::get(self::USER_INFO_URL, [
'key' => config('services.steam.client_secret'),
'steamids' => $user->game_id,
])->throw()->json('response.players.0');
});
return Cache::remember("users.{$user->id}.steam", now()->addMinutes(15),
function () use ($user, $steamKey) {
return Http::get(self::USER_INFO_URL, [
'key' => $steamKey,
'steamids' => $user->game_id,
])->throw()->json('response.players.0');
});
}

public function isExtensionCompatible(array $supportedGames)
Expand Down
7 changes: 5 additions & 2 deletions app/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ public function verifyEmail(User $user)

public function disable2fa(User $user)
{
$user->update(['two_factor_secret' => null]);
$user->forceFill([
'two_factor_secret' => null,
'two_factor_recovery_codes' => null,
])->save();

ActionLog::log('users.updated', $user);

Expand All @@ -165,7 +168,7 @@ public function destroy(User $user)
return redirect()->back();
}

$user->setDeleted();
$user->delete();

ActionLog::log('users.deleted', $user);

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function confirmDelete(Request $request)

ActionLog::log('users.deleted', $user);

$user->setDeleted();
$user->delete();
$request->session()->flush();

return redirect()
Expand Down
7 changes: 1 addition & 6 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,12 @@ public function isBanned(bool $useCache = false)
return $this->ban !== null;
}

public function getIsDeletedAttribute()
{
return $this->isDeleted();
}

public function isDeleted()
{
return $this->deleted_at !== null;
}

public function setDeleted()
protected function performDeleteOnModel()
{
$this->comments()->delete();
$this->likes()->delete();
Expand Down
2 changes: 1 addition & 1 deletion crowdin_export.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// as "crowdin_translations".

// The successfully translated locales (currently for >95% completed)
$locales = ['ca', 'cs', 'zh-CN', 'de', 'id', 'ru', 'es-ES'];
$locales = ['ca', 'cs', 'zh-CN', 'de', 'id', 'ko', 'ru', 'es-ES'];

if (! is_dir('crowdin_translations')) {
exit('The Crowdin translations must be in the "crowdin_translations" folder.');
Expand Down
44 changes: 22 additions & 22 deletions public/assets/admin/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -273,31 +273,14 @@ select.form-control:focus::-ms-value {
background-color: #4e73df;
}

.list-group-item-action {
color: #9394a8;
}

.list-group-item-action:hover, .list-group-item-action:focus {
color: #9394a8;
background-color: #f8f9fc;
}

.list-group-item-action:active {
color: #858796;
background-color: #eaecf4;
}

.list-group-item {
background-color: #fff;
}

.list-group-item.disabled, .list-group-item:disabled {
color: #858796;
background-color: #fff;
.list-group-item,
.list-group-item:hover {
color: #fff!important;
background-color: #1e1e1e!important;
border-color: #1e1e1e!important;
}

.list-group-item.active {
color: #fff;
background-color: #4e73df;
border-color: #4e73df;
}
Expand Down Expand Up @@ -336,6 +319,10 @@ select.form-control:focus::-ms-value {
color: #3a3b45 !important;
}

.text-dark {
color: #fff!important;
}

.dropdown .dropdown-menu .dropdown-header,
.navbar-nav .nav-item .small {
color: #b7b9cc!important;
Expand Down Expand Up @@ -407,3 +394,16 @@ h1.text-gray-800 {
.date-picker {
background: var(--background-elements) !important;
}

.CodeMirror {
color: rgba(255, 255, 255, 0.8)!important;
background-color: var(--background-elements-darker)!important;
}

.CodeMirror, .editor-toolbar {
border: 1px solid var(--background-elements)!important;
}

.editor-toolbar i {
color: #326abc;
}
2 changes: 1 addition & 1 deletion resources/lang/en/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
'line1' => 'You are receiving this email because we received a deletion request for your account.',
'action' => 'Delete my account',
'line2' => 'This action cannot be undone. This will permanently delete your account and associated data. This link will expire in :count minutes.',
'line3' => 'If you did not request a password reset, please make sure to review your security settings.',
'line3' => 'If you did not request your account deletion, please make sure to review your security settings.',
],
];
2 changes: 1 addition & 1 deletion resources/lang/fr/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@
'deleted' => 'Suppression de l\'utilisateur #:id',
'transfer' => 'Envoi d\'argent de :money à l\'utilisateur #:id',

'login' => 'Nouvelle connexion réusssie depuis :ip (A2F: :2fa)',
'login' => 'Nouvelle connexion réussie depuis :ip (A2F: :2fa)',
'2fa' => [
'enabled' => 'Activation de l\'authentification à deux facteurs',
'disabled' => 'Désactivation de l\'authentification à deux facteurs',
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/fr/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
'line1' => 'Vous recevez cet email parce que nous avons reçu une demande de suppression de votre compte.',
'action' => 'Supprimer mon compte',
'line2' => 'Cette action est définitive et il n\'est pas possible de revenir en arrière. Ce lien expirera dans :count minutes.',
'line3' => 'Si vous n\'avez pas demandé une réinitialisation de mot de passe, veuillez vérifier les paramètres de sécurité de votre compte.',
'line3' => 'Si vous n\'avez pas demandé la suppression de votre compte, veuillez vérifier vos paramètres de sécurité.',
],
];
5 changes: 5 additions & 0 deletions resources/sass/admin/_custom.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
img {
max-width: 100%;
height: auto;
}

.cursor-copy {
cursor: copy;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/admin/roles/_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</div>

<div id="permissionsGroup" class="{{ ($role->is_admin ?? false) ? 'collapse' : 'show' }}">
<div class="card card-body mb-2">
<div class="card card-body mb-2 pb-0">
<div class="row">
@foreach($permissions as $permission => $permissionDescription)
<div class="col-lg-6">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/install/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{ $v = $phpVersion }}
</span>
@elseif($requirementStatus)
<i class="bi-check-lg text-success float-right"></i>
<i class="bi-check2-circle text-success float-right"></i>
@else
<i class="bi bi-x-lg text-danger float-right"></i>
@endif
Expand Down
2 changes: 1 addition & 1 deletion resources/views/posts/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class="card mb-3">
<div class="card-body d-flex">
<div class="flex-shrink-0">
<img class="me-3 rounded" src="{{ $comment->author->getAvatar() }}" alt="{{ $comment->author->name }}" style="height: 60px; width: auto">
<img class="me-3 rounded" src="{{ $comment->author->getAvatar() }}" alt="{{ $comment->author->name }}" width="64">
</div>
<div class="flex-grow-1">
<div class="d-flex justify-content-between align-items-center">
Expand Down

0 comments on commit 8706d79

Please sign in to comment.