Skip to content
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
1 change: 1 addition & 0 deletions app/Helpers/database/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function getUserPageInfo(string $username, int $numGames = 0, int $numRecentAchi
$libraryOut['MemberSince'] = $user->created_at->__toString();
$libraryOut['LastActivity'] = $user->LastLogin?->__toString();
$libraryOut['RichPresenceMsg'] = empty($user->RichPresenceMsg) || $user->RichPresenceMsg === 'Unknown' ? null : $user->RichPresenceMsg;
$libraryOut['RichPresenceMsgDate'] = $user->RichPresenceMsgDate?->__toString();
$libraryOut['LastGameID'] = (int) $user->LastGameID;
$libraryOut['ContribCount'] = (int) $user->ContribCount;
$libraryOut['ContribYield'] = (int) $user->ContribYield;
Expand Down
1 change: 1 addition & 0 deletions public/API/API_GetUserSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* string? ReleasedAtGranularity how precise the Released value is. possible values are "day", "month", "year", and null.
* int IsFinal deprecated, will always be 0
* string RichPresenceMsg activity information about the last game the user played
* datetime RichPresenceUpdated when the RichPresenceMsg was last updated
* int RecentlyPlayedCount number of items in the RecentlyPlayed array
* array RecentlyPlayed
* int GameID unique identifier of the game
Expand Down
5 changes: 5 additions & 0 deletions tests/Feature/Api/V1/UserSummaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function testGetUserSummaryNoGameHistoryByName(): void
'TotalRanked' => 0,
'LastGameID' => null,
'RichPresenceMsg' => null,
'RichPresenceMsgDate' => null,
'RecentlyPlayedCount' => 0,
'RecentlyPlayed' => [],
]);
Expand Down Expand Up @@ -104,6 +105,7 @@ public function testGetUserSummaryNoGameHistoryByUlid(): void
'TotalRanked' => 0,
'LastGameID' => null,
'RichPresenceMsg' => null,
'RichPresenceMsgDate' => null,
'RecentlyPlayedCount' => 0,
'RecentlyPlayed' => [],
]);
Expand Down Expand Up @@ -221,6 +223,7 @@ public function testGetUserSummary(): void
'TotalRanked' => 2, // $this->user and $user
'LastGameID' => $game->id,
'RichPresenceMsg' => 'Playing ' . $game->title,
'RichPresenceMsgDate' => Carbon::now()->__toString(),
'RecentlyPlayedCount' => 0,
'RecentlyPlayed' => [],
'LastActivity' => [
Expand Down Expand Up @@ -275,6 +278,7 @@ public function testGetUserSummary(): void
'ReleasedAtGranularity' => $game->released_at_granularity->value,
],
'RichPresenceMsg' => 'Playing ' . $game->title,
'RichPresenceMsgDate' => Carbon::now()->__toString(),
'RecentlyPlayedCount' => 2,
'RecentlyPlayed' => [
[
Expand Down Expand Up @@ -388,6 +392,7 @@ public function testGetUserSummary(): void
'ReleasedAtGranularity' => $game->released_at_granularity->value,
],
'RichPresenceMsg' => 'Playing ' . $game->title,
'RichPresenceMsgDate' => Carbon::now()->__toString(),
'RecentlyPlayedCount' => 1,
'RecentlyPlayed' => [
[
Expand Down