Skip to content

Commit 31fcdcd

Browse files
authored
Merge branch 'master' into ranking-global
2 parents 0aab78f + d17f63f commit 31fcdcd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+566
-288
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ jobs:
102102
- name: Checkout
103103
uses: actions/checkout@v4
104104

105+
# otherwise docker compose will create .env directory
106+
- name: Create blank env file
107+
run: '> .env'
108+
105109
- name: Services
106110
run: 'docker compose up --quiet-pull --wait
107111
beatmap-difficulty-lookup-cache

app/Exceptions/ChangeUsernameException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ChangeUsernameException extends Exception
1212
{
1313
private $errors;
1414

15-
public function __construct($errors, Exception $previous = null)
15+
public function __construct($errors, ?Exception $previous = null)
1616
{
1717
if ($errors instanceof ValidationErrors) {
1818
$message = $errors->toSentence();

app/Exceptions/ValidationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ValidationException extends Exception
1212
{
1313
private $errors;
1414

15-
public function __construct(ValidationErrors $errors = null, Exception $previous = null)
15+
public function __construct(?ValidationErrors $errors = null, ?Exception $previous = null)
1616
{
1717
$message = null;
1818
if ($errors !== null) {

app/Http/Controllers/BeatmapDiscussionsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function review($beatmapsetId)
134134
priv_check('BeatmapsetDiscussionReviewStore', $beatmapset)->ensureCan();
135135

136136
try {
137-
$document = json_decode(request()->all()['document'] ?? '[]', true);
137+
$document = get_arr(json_decode(get_string(request('document')) ?? '[]', true)) ?? [];
138138
Review::create($beatmapset, $document, Auth::user());
139139
} catch (\Exception $e) {
140140
return error_popup($e->getMessage(), 422);

app/Http/Controllers/BeatmapsController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private static function assertSupporterOnlyOptions(?User $currentUser, string $t
4444
}
4545
}
4646

47+
// TODO: move this to scores() and remove soloScores(). Probably sometime after October 2025.
4748
private static function beatmapScores(string $id, ?string $scoreTransformerType, ?bool $isLegacy): array
4849
{
4950
$beatmap = Beatmap::findOrFail($id);
@@ -369,6 +370,8 @@ public function scores($id)
369370
*
370371
* Returns the top scores for a beatmap.
371372
*
373+
* This endpoint is deprecated. Use [Get Beatmap scores](#get-beatmap-scores) with appropriate api version header instead.
374+
*
372375
* ---
373376
*
374377
* ### Response Format

app/Http/Controllers/BeatmapsetsController.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,17 @@ private function showJson($beatmapset)
407407
$transformer = new BeatmapsetTransformer();
408408
$transformer->relatedUsersType = 'show';
409409

410+
static $sharedIncludes = [
411+
'failtimes',
412+
'owners',
413+
'top_tag_ids',
414+
];
415+
410416
return json_item($beatmapset, $transformer, [
411-
'beatmaps',
412-
'beatmaps.failtimes',
413-
'beatmaps.max_combo',
414-
'beatmaps.owners',
417+
...array_map(fn ($include) => "beatmaps.{$include}", $sharedIncludes),
415418
'beatmaps.current_user_tag_ids',
416-
'beatmaps.top_tag_ids',
417-
'converts',
418-
'converts.failtimes',
419-
'converts.owners',
419+
'beatmaps.max_combo',
420+
...array_map(fn ($include) => "converts.{$include}", $sharedIncludes),
420421
'current_nominations',
421422
'current_user_attributes',
422423
'description',

app/Http/Controllers/Multiplayer/RoomsController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,8 @@ public function index()
4949
$includes = ['host.country', 'playlist.beatmap'];
5050

5151
$search = Room::search($params);
52-
$query = $search['query'];
5352

54-
// temporary workaround for lazer client failing to deserialise `daily_challenge` room category
55-
// can be removed 20241129
56-
if ($apiVersion < 20240529) {
57-
$query->whereNot('category', 'daily_challenge');
58-
}
59-
60-
$rooms = $query
53+
$rooms = $search['query']
6154
->with($includes)
6255
->withRecentParticipantIds()
6356
->get();

app/Http/Controllers/UsersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public function scores($_userId, $type)
532532

533533
$perPage = $this->perPage;
534534

535-
if ($type === 'firsts' || $type === 'pinned') {
535+
if (in_array($type, ['best', 'firsts', 'pinned'], true)) {
536536
// Override per page restriction in parsePaginationParams to allow infinite paging
537537
$perPage = $this->sanitizedLimitParam();
538538
}

app/Jobs/RegenerateBeatmapsetCover.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RegenerateBeatmapsetCover implements ShouldQueue
3535
*
3636
* @return void
3737
*/
38-
public function __construct(Beatmapset $beatmapset, array $sizesToRegenerate = null)
38+
public function __construct(Beatmapset $beatmapset, ?array $sizesToRegenerate = null)
3939
{
4040
$this->beatmapset = $beatmapset;
4141
$this->sizesToRegenerate = $sizesToRegenerate;

app/Libraries/BeatmapsetDiscussion/Review.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static function update(BeatmapDiscussion $discussion, array $document, Us
8989
return (new static($beatmapset, $user, $document, $discussion))->process();
9090
}
9191

92-
private function createDiscussion(string $discussionType, string $message, int $beatmapId = null, string $timestamp = null)
92+
private function createDiscussion(string $discussionType, string $message, ?int $beatmapId = null, ?string $timestamp = null)
9393
{
9494
$userId = $this->user->getKey();
9595

0 commit comments

Comments
 (0)