Skip to content

Commit

Permalink
Merge branch 'master' into private-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 21, 2023
2 parents 38192fb + 6718039 commit f4d120a
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 74 deletions.
2 changes: 1 addition & 1 deletion app/Libraries/BBCodeFromDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function parseBoxHelperPrefix($linkText = null)
{
$linkText = presence($linkText) ?? 'SPOILER';

return "<div class='js-spoilerbox bbcode-spoilerbox'><button class='js-spoilerbox__link bbcode-spoilerbox__link' type='button'><span class='bbcode-spoilerbox__link-icon'></span>{$linkText}</button><div class='bbcode-spoilerbox__body'>";
return "<div class='js-spoilerbox bbcode-spoilerbox'><a class='js-spoilerbox__link bbcode-spoilerbox__link' href='#'><span class='bbcode-spoilerbox__link-icon'></span>{$linkText}</a><div class='bbcode-spoilerbox__body'>";
}

public function parseBoxHelperSuffix()
Expand Down
8 changes: 0 additions & 8 deletions app/Libraries/CleanHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ public function __construct()
]
);

$def->addElement(
'button',
'Formctrl',
'Optional: #PCDATA | Heading | List | Block | Inline',
'Common',
['type' => 'Enum#button'],
);

$def->addAttribute('audio', 'preload', 'Text');

$def->addAttribute('img', 'loading', 'Text');
Expand Down
10 changes: 6 additions & 4 deletions app/Libraries/Search/ScoreSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ public function queueForIndex(?array $schemas, array $ids): void

$schemas ??= $this->getActiveSchemas();

$values = array_map(
static fn (int $id): string => json_encode(['ScoreId' => $id]),
$ids,
);

foreach ($schemas as $schema) {
LaravelRedis::lpush("osu-queue:score-index-{$schema}", ...array_map(
fn (int $id): string => json_encode(['ScoreId' => $id]),
$ids,
));
LaravelRedis::lpush("osu-queue:score-index-{$schema}", ...$values);
}
}

Expand Down
21 changes: 12 additions & 9 deletions app/Models/Solo/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
/**
* @property int $beatmap_id
* @property \Carbon\Carbon|null $created_at
* @property \stdClass $data
* @property \Carbon\Carbon|null $deleted_at
* @property string|null $created_at_json
* @property ScoreData $data
* @property bool $has_replay
* @property int $id
* @property bool $preserve
* @property bool $ranked
* @property int $ruleset_id
* @property \Carbon\Carbon|null $updated_at
* @property int $unix_updated_at
* @property User $user
* @property int $user_id
*/
Expand All @@ -39,6 +41,8 @@ class Score extends Model implements Traits\ReportableInterface

const PROCESSING_QUEUE = 'osu-queue:score-statistics';

public $timestamps = false;

protected $casts = [
'data' => ScoreData::class,
'has_replay' => 'boolean',
Expand Down Expand Up @@ -160,18 +164,17 @@ public function getAttribute($key)
'beatmap_id',
'id',
'ruleset_id',
'unix_updated_at',
'user_id' => $this->getRawAttribute($key),

'data' => $this->getClassCastableAttributeValue($key, $this->getRawAttribute($key)),

'has_replay',
'preserve' => (bool) $this->getRawAttribute($key),

'created_at',
'updated_at' => $this->getTimeFast($key),
'preserve',
'ranked' => (bool) $this->getRawAttribute($key),

'created_at_json',
'updated_at_json' => $this->getJsonTimeFast($key),
'created_at' => $this->getTimeFast($key),
'created_at_json' => $this->getJsonTimeFast($key),

'pp' => $this->performance?->pp,

Expand Down
69 changes: 69 additions & 0 deletions database/migrations/2023_12_18_085034_update_scores_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
private static function resetView(): void
{
DB::statement('DROP VIEW scores');
DB::statement('CREATE VIEW scores AS SELECT * FROM solo_scores');
}

public function up(): void
{
Schema::table('solo_scores', function (Blueprint $table) {
$table->dropColumn('updated_at');

$table->dropIndex('solo_scores_beatmap_id_index');
$table->dropIndex('solo_scores_preserve_index');
$table->dropIndex('user_ruleset_id_index');

$table->boolean('ranked')->default(true)->after('preserve');
$table->unsignedInteger('unix_updated_at')->default(DB::raw('(unix_timestamp())'));
$table->timestamp('created_at')->useCurrent()->change();

$table->index(['user_id', 'ruleset_id'], 'user_ruleset_index');
$table->index(['beatmap_id', 'user_id'], 'beatmap_user_index');
});

DB::statement('ALTER TABLE solo_scores MODIFY id bigint unsigned NOT NULL');
DB::statement('ALTER TABLE solo_scores DROP PRIMARY KEY');
DB::statement('ALTER TABLE solo_scores ADD PRIMARY KEY (id, preserve, unix_updated_at)');
DB::statement('ALTER TABLE solo_scores MODIFY id bigint unsigned NOT NULL AUTO_INCREMENT');

static::resetView();
}

public function down(): void
{
Schema::table('solo_scores', function (Blueprint $table) {
$table->dropColumn('unix_updated_at');
$table->dropColumn('ranked');

$table->dropIndex('user_ruleset_index');
$table->dropIndex('beatmap_user_index');

$table->datetime('created_at')->change();
$table->timestamp('updated_at')->nullable(true);

$table->index('preserve', 'solo_scores_preserve_index');
$table->index('beatmap_id', 'solo_scores_beatmap_id_index');
$table->index(['user_id', 'ruleset_id', DB::raw('id DESC')], 'user_ruleset_id_index');
});

DB::statement('ALTER TABLE solo_scores MODIFY id bigint unsigned NOT NULL');
DB::statement('ALTER TABLE solo_scores DROP PRIMARY KEY');
DB::statement('ALTER TABLE solo_scores ADD PRIMARY KEY (id)');
DB::statement('ALTER TABLE solo_scores MODIFY id bigint unsigned NOT NULL AUTO_INCREMENT');

static::resetView();
}
};
40 changes: 8 additions & 32 deletions database/mods.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"SD",
"PF",
"AC",
"RX",
"AP"
],
"RequiresConfiguration": false,
Expand Down Expand Up @@ -142,7 +141,6 @@
"NF",
"PF",
"TP",
"RX",
"AP"
],
"RequiresConfiguration": false,
Expand All @@ -168,7 +166,6 @@
"NF",
"SD",
"AC",
"RX",
"AP"
],
"RequiresConfiguration": false,
Expand Down Expand Up @@ -357,7 +354,6 @@
"EZ",
"NF",
"PF",
"RX",
"AP"
],
"RequiresConfiguration": false,
Expand Down Expand Up @@ -634,10 +630,6 @@
"Type": "Automation",
"Settings": [],
"IncompatibleMods": [
"NF",
"SD",
"PF",
"AC",
"AL",
"SG",
"AT",
Expand Down Expand Up @@ -1222,8 +1214,7 @@
"IncompatibleMods": [
"SD",
"PF",
"AC",
"RX"
"AC"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand Down Expand Up @@ -1324,8 +1315,7 @@
],
"IncompatibleMods": [
"NF",
"PF",
"RX"
"PF"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand All @@ -1349,8 +1339,7 @@
"IncompatibleMods": [
"NF",
"SD",
"AC",
"RX"
"AC"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand Down Expand Up @@ -1486,8 +1475,7 @@
],
"IncompatibleMods": [
"NF",
"PF",
"RX"
"PF"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand Down Expand Up @@ -1647,10 +1635,6 @@
"Type": "Automation",
"Settings": [],
"IncompatibleMods": [
"NF",
"SD",
"PF",
"AC",
"SG",
"AT",
"CN"
Expand Down Expand Up @@ -1864,8 +1848,7 @@
"IncompatibleMods": [
"SD",
"PF",
"AC",
"RX"
"AC"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand Down Expand Up @@ -1964,8 +1947,7 @@
],
"IncompatibleMods": [
"NF",
"PF",
"RX"
"PF"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand All @@ -1989,8 +1971,7 @@
"IncompatibleMods": [
"NF",
"SD",
"AC",
"RX"
"AC"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand Down Expand Up @@ -2125,8 +2106,7 @@
"IncompatibleMods": [
"EZ",
"NF",
"PF",
"RX"
"PF"
],
"RequiresConfiguration": false,
"UserPlayable": true,
Expand Down Expand Up @@ -2253,10 +2233,6 @@
"Type": "Automation",
"Settings": [],
"IncompatibleMods": [
"NF",
"SD",
"PF",
"AC",
"AT",
"CN"
],
Expand Down
2 changes: 2 additions & 0 deletions resources/css/bem/profile-info.less
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@

&--supporter {
.center-content();
.link-plain();
.link-white();
border-radius: 10000px;
background-color: @osu-colour-h1;
padding: 0 10px;
Expand Down
14 changes: 12 additions & 2 deletions resources/js/beatmapsets-show/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,23 @@ export default class Header extends React.Component<Props> {
<span className='fas fa-image' />
</div>
}
<div className='beatmapset-status beatmapset-status--show'>
<a className='beatmapset-status beatmapset-status--show' href={this.statusToWikiLink(this.controller.currentBeatmap.status)}>
{trans(`beatmapsets.show.status.${this.controller.currentBeatmap.status}`)}
</div>
</a>
</div>
);
}

private statusToWikiLink(status: string): string {
let fragment: string;
if (status === 'wip' || status === 'pending') {
fragment = 'wip-and-pending';
} else {
fragment = status;
}
return wikiUrl(`Beatmap/Category#${fragment}`);
}

private readonly updateFavouritePopup = () => {
if (!this.hoveredFavouriteIcon) {
return;
Expand Down
4 changes: 2 additions & 2 deletions resources/js/profile-page/cover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ export default class Cover extends React.Component<Props> {
return (
<>
{this.props.user.is_supporter &&
<span className='profile-info__icon profile-info__icon--supporter' title={trans('users.show.is_supporter')}>
<a className='profile-info__icon profile-info__icon--supporter' href={route('support-the-game')} title={trans('users.show.is_supporter')}>
{times(this.props.user.support_level ?? 0, (i) => <span key={i} className='fas fa-heart' />)}
</span>
</a>
}
<UserGroupBadges groups={this.props.user.groups} modifiers='profile-page' wrapper='profile-info__icon' />
</>
Expand Down
6 changes: 3 additions & 3 deletions tests/Libraries/ModsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ public static function modComboExclusives()
[Ruleset::mania, ['DT'], ['PF'], true],

// conflicting exclusive required mods
[Ruleset::osu, ['RX', 'PF'], [], false],
[Ruleset::osu, ['HT', 'DT'], [], false],
[Ruleset::mania, ['FI', 'HD'], [], false],

// allowed mods conflicts with exclusive required mods
[Ruleset::osu, ['RX'], ['PF'], false],
[Ruleset::taiko, ['RX'], ['PF'], false],
[Ruleset::osu, ['HT'], ['DT'], false],
[Ruleset::taiko, ['HT'], ['DT'], false],
];
}
}
8 changes: 4 additions & 4 deletions tests/Libraries/bbcode_examples/box_nested.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="js-spoilerbox bbcode-spoilerbox">
<button class="js-spoilerbox__link bbcode-spoilerbox__link" type="button">
<a class="js-spoilerbox__link bbcode-spoilerbox__link" href="#">
<span class="bbcode-spoilerbox__link-icon"></span>hello
</button>
</a>
<div class="bbcode-spoilerbox__body">
<div class="js-spoilerbox bbcode-spoilerbox">
<button class="js-spoilerbox__link bbcode-spoilerbox__link" type="button">
<a class="js-spoilerbox__link bbcode-spoilerbox__link" href="#">
<span class="bbcode-spoilerbox__link-icon"></span>another box
</button>
</a>
<div class="bbcode-spoilerbox__body">Content</div>
</div>
Another content
Expand Down
Loading

0 comments on commit f4d120a

Please sign in to comment.