diff --git a/app/Helpers/database/user.php b/app/Helpers/database/user.php index 998b687ecd..3c3ddc7682 100644 --- a/app/Helpers/database/user.php +++ b/app/Helpers/database/user.php @@ -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; diff --git a/public/API/API_GetUserSummary.php b/public/API/API_GetUserSummary.php index d3fc677af0..1ce89257d1 100644 --- a/public/API/API_GetUserSummary.php +++ b/public/API/API_GetUserSummary.php @@ -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 diff --git a/tests/Feature/Api/V1/UserSummaryTest.php b/tests/Feature/Api/V1/UserSummaryTest.php index adc422566e..ce2f96de81 100644 --- a/tests/Feature/Api/V1/UserSummaryTest.php +++ b/tests/Feature/Api/V1/UserSummaryTest.php @@ -72,6 +72,7 @@ public function testGetUserSummaryNoGameHistoryByName(): void 'TotalRanked' => 0, 'LastGameID' => null, 'RichPresenceMsg' => null, + 'RichPresenceMsgDate' => null, 'RecentlyPlayedCount' => 0, 'RecentlyPlayed' => [], ]); @@ -104,6 +105,7 @@ public function testGetUserSummaryNoGameHistoryByUlid(): void 'TotalRanked' => 0, 'LastGameID' => null, 'RichPresenceMsg' => null, + 'RichPresenceMsgDate' => null, 'RecentlyPlayedCount' => 0, 'RecentlyPlayed' => [], ]); @@ -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' => [ @@ -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' => [ [ @@ -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' => [ [