Skip to content

Commit 6c11e4d

Browse files
authored
feat(api): add RichPresenceMsgDate to API_GetUserSummary.php (#4156)
1 parent dca91a0 commit 6c11e4d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

app/Helpers/database/user.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function getUserPageInfo(string $username, int $numGames = 0, int $numRecentAchi
6161
$libraryOut['MemberSince'] = $user->created_at->__toString();
6262
$libraryOut['LastActivity'] = $user->LastLogin?->__toString();
6363
$libraryOut['RichPresenceMsg'] = empty($user->RichPresenceMsg) || $user->RichPresenceMsg === 'Unknown' ? null : $user->RichPresenceMsg;
64+
$libraryOut['RichPresenceMsgDate'] = $user->RichPresenceMsgDate?->__toString();
6465
$libraryOut['LastGameID'] = (int) $user->LastGameID;
6566
$libraryOut['ContribCount'] = (int) $user->ContribCount;
6667
$libraryOut['ContribYield'] = (int) $user->ContribYield;

public/API/API_GetUserSummary.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* string? ReleasedAtGranularity how precise the Released value is. possible values are "day", "month", "year", and null.
4343
* int IsFinal deprecated, will always be 0
4444
* string RichPresenceMsg activity information about the last game the user played
45+
* datetime RichPresenceUpdated when the RichPresenceMsg was last updated
4546
* int RecentlyPlayedCount number of items in the RecentlyPlayed array
4647
* array RecentlyPlayed
4748
* int GameID unique identifier of the game

tests/Feature/Api/V1/UserSummaryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function testGetUserSummaryNoGameHistoryByName(): void
7272
'TotalRanked' => 0,
7373
'LastGameID' => null,
7474
'RichPresenceMsg' => null,
75+
'RichPresenceMsgDate' => null,
7576
'RecentlyPlayedCount' => 0,
7677
'RecentlyPlayed' => [],
7778
]);
@@ -104,6 +105,7 @@ public function testGetUserSummaryNoGameHistoryByUlid(): void
104105
'TotalRanked' => 0,
105106
'LastGameID' => null,
106107
'RichPresenceMsg' => null,
108+
'RichPresenceMsgDate' => null,
107109
'RecentlyPlayedCount' => 0,
108110
'RecentlyPlayed' => [],
109111
]);
@@ -221,6 +223,7 @@ public function testGetUserSummary(): void
221223
'TotalRanked' => 2, // $this->user and $user
222224
'LastGameID' => $game->id,
223225
'RichPresenceMsg' => 'Playing ' . $game->title,
226+
'RichPresenceMsgDate' => Carbon::now()->__toString(),
224227
'RecentlyPlayedCount' => 0,
225228
'RecentlyPlayed' => [],
226229
'LastActivity' => [
@@ -275,6 +278,7 @@ public function testGetUserSummary(): void
275278
'ReleasedAtGranularity' => $game->released_at_granularity->value,
276279
],
277280
'RichPresenceMsg' => 'Playing ' . $game->title,
281+
'RichPresenceMsgDate' => Carbon::now()->__toString(),
278282
'RecentlyPlayedCount' => 2,
279283
'RecentlyPlayed' => [
280284
[
@@ -388,6 +392,7 @@ public function testGetUserSummary(): void
388392
'ReleasedAtGranularity' => $game->released_at_granularity->value,
389393
],
390394
'RichPresenceMsg' => 'Playing ' . $game->title,
395+
'RichPresenceMsgDate' => Carbon::now()->__toString(),
391396
'RecentlyPlayedCount' => 1,
392397
'RecentlyPlayed' => [
393398
[

0 commit comments

Comments
 (0)