Skip to content

Commit

Permalink
Show "status unknown" by avatar if last update was over 3 minutes ago
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumos committed Sep 18, 2024
1 parent 61e291d commit 6d8473e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/Models/SteamUserMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class SteamUserMetadata extends Model
'apps_updated_at',
];

protected $casts = [
'profile_updated_at' => 'datetime',
'apps_updated_at' => 'datetime',
];

protected $table = 'steam_user_metadata';

public $timestamps = false;
Expand Down
5 changes: 4 additions & 1 deletion resources/views/pages/users/partials/avatar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
if($activeSession) {
$statusName = 'in-game';
$statusDisplayName = __('phrase.status-in-game-x', ['x' => $activeSession->app->name]);
} elseif($user->steamMetadata->exists) {
} elseif(
$user->steamMetadata->exists &&
$user->steamMetadata->profile_updated_at->greaterThan(now()->subMinutes(3))
) {
$statusName = $user->steamMetadata->status->name;
$statusDisplayName = $user->steamMetadata->status->display_name;
} else {
Expand Down

0 comments on commit 6d8473e

Please sign in to comment.