Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into solo-score-attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Oct 27, 2022
2 parents dc9a2dd + 7d89312 commit dde1c16
Show file tree
Hide file tree
Showing 237 changed files with 2,234 additions and 1,814 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ OSU_RUNNING_COST=

CLIENT_CHECK_VERSION=false
# CLIENT_USER_AGENT=osu!
# DEFAULT_BUILD_ID=0

# SEARCH_MINIMUM_LENGTH=2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Install js dependencies
run: yarn --frozen-lockfile

- run: yarn lint --quiet
- run: 'yarn lint --max-warnings 197 > /dev/null'

- run: ./bin/update_licence.sh -nf

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- private-staging
tags:
- '*'

Expand Down Expand Up @@ -85,7 +86,7 @@ jobs:
version: osu-web@${{ github.ref_name }}

push_to_staging:
if: ${{ github.ref_type == 'branch' }}
if: ${{ github.ref_type == 'branch' && github.ref_name == 'master' }}
runs-on: ubuntu-latest
needs:
- push_to_registry
Expand Down
6 changes: 4 additions & 2 deletions app/Console/Commands/BuildsCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ public function handle()
$streamId = get_int($this->option('stream-id'));

if ($streamId === null) {
return $this->error('Missing stream-id');
$this->error('Missing stream-id');
return;
}

$stream = UpdateStream::findOrFail($streamId);

$build = $stream->createBuild();

if ($build === null) {
return $this->info('No build created (probably no orphan changelog entry).');
$this->info('No build created (probably no orphan changelog entry).');
return;
}

$this->info("Created build {$build->displayVersion()}");
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/EsIndexDocuments.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function handle()

$continue = $this->starterMessage($oldIndices);
if (!$continue) {
return $this->error('User aborted!');
$this->error('User aborted!');
return;
}

$start = time();
Expand Down
8 changes: 1 addition & 7 deletions app/Console/Commands/EsIndexScoresQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,7 @@ public function handle()
{
$this->search = new ScoreSearch();

try {
$this->parseOptions();
} catch (InvariantException $e) {
$this->error($e->getMessage());

return 1;
}
$this->parseOptions();

if (!$this->confirm('This will queue scores for indexing to schema '.implode(', ', $this->schemas).', continue?', true)) {
return $this->info('User aborted');
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/EsIndexWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function handle()

$continue = $this->starterMessage();
if (!$continue) {
return $this->error('User aborted!');
$this->error('User aborted!');
return;
}

if (!Es::getClient()->indices()->exists(['index' => [$this->indexName]])) {
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/FixForumDisplayOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function handle()
$continue = $this->confirm('Proceed?');

if (!$continue) {
return $this->error('Aborted.');
$this->error('Aborted.');
return;
}

$this->startReorder();
Expand Down
6 changes: 4 additions & 2 deletions app/Console/Commands/FixMissingUserChannels.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function handle()
$continue = $this->confirm('Proceed?');

if (!$continue) {
return $this->error('Aborted.');
$this->error('Aborted.');
return;
}

$start = time();
Expand All @@ -60,7 +61,8 @@ public function handle()

// reconfirm
if (!$this->confirm("{$count} channels need to be repaired, proceed?")) {
return $this->error('Aborted.');
$this->error('Aborted.');
return;
}

$start = time();
Expand Down
6 changes: 4 additions & 2 deletions app/Console/Commands/FixUsernameChangeTopicCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function handle()
$continue = $this->confirm('WARNING! This will refresh the cache for forum topics effected by username changes after 2017/08/09');

if (!$continue) {
return $this->error('User aborted!');
$this->error('User aborted!');
return;
}

$start = time();
Expand Down Expand Up @@ -74,7 +75,8 @@ public function handle()

// reconfirm.
if (!$this->confirm("This will affect an estimated {$count} Topics.")) {
return $this->error('User aborted!');
$this->error('User aborted!');
return;
}

$start = time();
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/ForumTopicCoversCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function handle()
$this->line("This will delete unused topic covers before {$createdBefore}.");

if (!$this->option('yes') && !$this->confirm('Proceed?')) {
return $this->error('Aborted.');
$this->error('Aborted.');
return;
}

$progress = $this->output->createProgressBar();
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/MigrateFreshAllCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function handle()

$continue = $this->option('yes') || $this->confirm('continue?');
if (!$continue) {
return $this->error('User aborted!');
$this->error('User aborted!');
return;
}

foreach (array_keys($connections) as $database) {
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ModdingRankCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private function rankAll($modeInt)
$rankedTodayCount = Beatmapset::ranked()
->withoutTrashed()
->withModesForRanking($modeInt)
->where('approved_date', '>=', now()->subDay())
->where('approved_date', '>=', now()->subDays())
->count();

$rankableQuota = config('osu.beatmapset.rank_per_day') - $rankedTodayCount;
Expand Down
10 changes: 7 additions & 3 deletions app/Console/Commands/UserRecalculateRankCounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

class UserRecalculateRankCounts extends Command
{
private ?int $from;
private ?int $until;

/**
* The name and signature of the console command.
*
Expand All @@ -34,13 +37,14 @@ class UserRecalculateRankCounts extends Command
*/
public function handle()
{
$this->from = $this->option('from');
$this->until = $this->option('until');
$this->from = get_int($this->option('from'));
$this->until = get_int($this->option('until'));

$continue = $this->confirm('This will recalculate and update the rank counts for user statistics, continue?');

if (!$continue) {
return $this->error('User aborted!');
$this->error('User aborted!');
return;
}

$start = time();
Expand Down
3 changes: 1 addition & 2 deletions app/Events/Fulfillments/PaymentEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

class PaymentEvent implements HasOrder
{
public function __construct(Order $order)
public function __construct(public Order $order)
{
$this->order = $order;
}

public function getOrder()
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function report(Throwable $e)
$this->reportWithSentry($e);
}

return parent::report($e);
parent::report($e);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Account/SessionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct()
$this->middleware('auth');
$this->middleware('verify-user');

return parent::__construct();
parent::__construct();
}

public function destroy($id)
Expand Down
12 changes: 9 additions & 3 deletions app/Http/Controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct()
'verifyLink',
]]);

return parent::__construct();
parent::__construct();
}

public function avatar()
Expand Down Expand Up @@ -177,15 +177,21 @@ public function updateNotificationOptions()
}

DB::transaction(function () use ($requestParams) {
// FIXME: less queries
$user = auth()->user();
$user
->notificationOptions()
->whereIn('name', array_keys($requestParams))
->select('user_id')
->lockForUpdate()
->get();
foreach ($requestParams as $key => $value) {
if (!UserNotificationOption::supportsNotifications($key)) {
continue;
}

$params = get_params($value, null, ['details:any']);

$option = auth()->user()->notificationOptions()->firstOrNew(['name' => $key]);
$option = $user->notificationOptions()->firstOrNew(['name' => $key]);
// TODO: show correct field error.
$option->fill($params)->saveOrExplode();
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function __construct()
return $next($request);
});

return parent::__construct();
parent::__construct();
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/BeatmapDiscussionPostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct()
$this->middleware('auth', ['except' => ['index', 'show']]);
$this->middleware('require-scopes:public', ['only' => ['index']]);

return parent::__construct();
parent::__construct();
}

public function destroy($id)
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/BeatmapDiscussionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
$this->middleware('auth', ['except' => ['index', 'show']]);
$this->middleware('require-scopes:public', ['only' => ['index']]);

return parent::__construct();
parent::__construct();
}

public function allowKudosu($id)
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/BeatmapsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ public function soloScores($id)

$esFetch = new BeatmapScores([
'beatmap_ids' => [$beatmap->getKey()],
'is_legacy' => false,
'mods' => $mods,
'ruleset_id' => $rulesetId,
'type' => $type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct()
{
$this->middleware('require-scopes:public');

return parent::__construct();
parent::__construct();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/BeatmapsetEventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
{
$this->middleware('require-scopes:public', ['only' => ['index']]);

return parent::__construct();
parent::__construct();
}

public function index()
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/BeatmapsetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function discussionUnlock($id)
priv_check('BeatmapsetDiscussionLock')->ensureCan();

$beatmapset = Beatmapset::findOrFail($id);
$beatmapset->discussionUnlock(Auth::user(), request('reason'));
$beatmapset->discussionUnlock(Auth::user());

return $beatmapset->defaultDiscussionJson();
}
Expand All @@ -168,7 +168,7 @@ public function discussionLock($id)
public function download($id)
{
if (!is_api_request() && !from_app_url()) {
return ujs_redirect(route('beatmapsets.show', ['beatmapset' => $id]));
return ujs_redirect(route('beatmapsets.show', ['beatmapset' => rawurlencode($id)]));
}

$beatmapset = Beatmapset::findOrFail($id);
Expand All @@ -180,7 +180,7 @@ public function download($id)
priv_check('BeatmapsetDownload', $beatmapset)->ensureCan();

$recentlyDownloaded = BeatmapDownload::where('user_id', Auth::user()->user_id)
->where('timestamp', '>', Carbon::now()->subHour()->getTimestamp())
->where('timestamp', '>', Carbon::now()->subHours()->getTimestamp())
->count();

if ($recentlyDownloaded > Auth::user()->beatmapsetDownloadAllowance()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/BlocksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct()
],
]);

return parent::__construct();
parent::__construct();
}

public function store()
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Chat/ChannelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct()
{
$this->middleware('require-scopes:chat.write', ['only' => 'store']);

return parent::__construct();
parent::__construct();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Chat/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct()
$this->middleware('require-scopes:chat.write', ['only' => 'newConversation']);
$this->middleware('auth');

return parent::__construct();
parent::__construct();
}

public function ack()
Expand All @@ -38,7 +38,7 @@ public function ack()
], ['null_missing' => true]);

return [
'silences' => json_collection($this->getSilences($params['history_since'], $params['since']), new UserSilenceTransformer()),
'silences' => json_collection($this->getSilences($params['history_since'], $params['since'] ?? 0), new UserSilenceTransformer()),
];
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Chat/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public function __construct()
{
$this->middleware('auth');

return parent::__construct();
parent::__construct();
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
$this->middleware('verify-user');
}

return parent::__construct();
parent::__construct();
}

public function index()
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ClientVerificationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct()
$this->middleware('verify-user');
$this->middleware('throttle:60,10');

return parent::__construct();
parent::__construct();
}

public function create()
Expand Down
Loading

0 comments on commit dde1c16

Please sign in to comment.