From 5367579f045b8401a133759300189cf3faa653ad Mon Sep 17 00:00:00 2001 From: nanaya Date: Tue, 6 Dec 2022 19:27:38 +0900 Subject: [PATCH] Private staging specific changes - add footer indicating experimental things - always show the new total score - add check for nextCursor is_legacy --- app/Libraries/Score/FetchDedupedScores.php | 6 ++++-- resources/css/bem/development-deploy-footer.less | 2 +- resources/js/core/link-main-host.ts | 16 ++++++++++++++++ resources/js/osu-core.ts | 3 +++ resources/js/utils/score-helper.ts | 2 +- resources/views/master.blade.php | 5 ++--- 6 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 resources/js/core/link-main-host.ts diff --git a/app/Libraries/Score/FetchDedupedScores.php b/app/Libraries/Score/FetchDedupedScores.php index f796fda7d9d..ced665cca8b 100644 --- a/app/Libraries/Score/FetchDedupedScores.php +++ b/app/Libraries/Score/FetchDedupedScores.php @@ -35,8 +35,10 @@ public function all(): array while ($hasNext) { if ($nextCursor !== null) { - // FIXME: cursor value returned is 0/1 but elasticsearch expects false/true... - $nextCursor['is_legacy'] = get_bool($nextCursor['is_legacy']); + if (isset($nextCursor['is_legacy'])) { + // FIXME: cursor value returned is 0/1 string but elasticsearch expects false/true... + $nextCursor['is_legacy'] = get_bool($nextCursor['is_legacy']); + } $search->searchAfter(array_values($nextCursor)); } $response = $search->response(); diff --git a/resources/css/bem/development-deploy-footer.less b/resources/css/bem/development-deploy-footer.less index 3f933082abe..22f023239c4 100644 --- a/resources/css/bem/development-deploy-footer.less +++ b/resources/css/bem/development-deploy-footer.less @@ -4,7 +4,7 @@ .development-deploy-footer { width: 100%; padding: 10px; - background: hsl(var(--hsl-red-3)); + background: hsl(var(--hsl-blue-3)); text-align: center; font-weight: bold; diff --git a/resources/js/core/link-main-host.ts b/resources/js/core/link-main-host.ts new file mode 100644 index 00000000000..4c7ab0676fe --- /dev/null +++ b/resources/js/core/link-main-host.ts @@ -0,0 +1,16 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the GNU Affero General Public License v3.0. +// See the LICENCE file in the repository root for full licence text. + +const className = 'js-link-main-host'; +const searchQuery = `.${className}`; + +export default class LinkMainHost { + constructor() { + $(document).on('click', searchQuery, this.handleClick); + } + + private readonly handleClick = (e: JQuery.Event) => { + e.preventDefault(); + window.location.host = 'osu.ppy.sh'; + }; +} diff --git a/resources/js/osu-core.ts b/resources/js/osu-core.ts index cc20073a9fd..f4f6bcc53c1 100644 --- a/resources/js/osu-core.ts +++ b/resources/js/osu-core.ts @@ -11,6 +11,7 @@ import ForumPoll from 'core/forum/forum-poll'; import ForumPostEdit from 'core/forum/forum-post-edit'; import ForumPostInput from 'core/forum/forum-post-input'; import ForumPostReport from 'core/forum/forum-post-report'; +import LinkMainHost from 'core/link-main-host'; import Localtime from 'core/localtime'; import MobileToggle from 'core/mobile-toggle'; import OsuAudio from 'core/osu-audio/main'; @@ -49,6 +50,7 @@ export default class OsuCore { readonly forumPostEdit; readonly forumPostInput; readonly forumPostReport; + readonly linkMainHost; readonly localtime; readonly mobileToggle; readonly notificationsWorker; @@ -94,6 +96,7 @@ export default class OsuCore { this.forumPostEdit = new ForumPostEdit(); this.forumPostInput = new ForumPostInput(); this.forumPostReport = new ForumPostReport(); + this.linkMainHost = new LinkMainHost(); this.localtime = new Localtime(); this.mobileToggle = new MobileToggle(); this.browserTitleWithNotificationCount = new BrowserTitleWithNotificationCount(this); diff --git a/resources/js/utils/score-helper.ts b/resources/js/utils/score-helper.ts index 2f6ca4fe335..bc2140fec7b 100644 --- a/resources/js/utils/score-helper.ts +++ b/resources/js/utils/score-helper.ts @@ -123,5 +123,5 @@ export function scoreUrl(score: SoloScoreJson) { } export function totalScore(score: SoloScoreJson) { - return score.legacy_total_score ?? score.total_score; + return score.total_score; } diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index b7f4df18910..996fabf5975 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -110,11 +110,10 @@ class="js-permanent-fixed-footer > @yield('permanent-fixed-footer') - @if (config('osu.is_development_deploy')) - @endif