diff --git a/app/Http/Controllers/Forum/TopicsController.php b/app/Http/Controllers/Forum/TopicsController.php index 76dca0b2b6f..502638b28ed 100644 --- a/app/Http/Controllers/Forum/TopicsController.php +++ b/app/Http/Controllers/Forum/TopicsController.php @@ -166,7 +166,11 @@ public function issueTag($id) $state = get_bool(Request::input('state')); $type = 'issue_tag_'.$issueTag; - if ($issueTag === null || !$topic->isIssue() || !in_array($issueTag, $topic::ISSUE_TAGS, true)) { + if ( + $issueTag === null + || !$topic->isIssue() + || !in_array($issueTag, array_merge($topic::ISSUE_TAGS, $topic::PLATFORM_ISSUE_TAGS), true) + ) { abort(422); } diff --git a/app/Models/Forum/Topic.php b/app/Models/Forum/Topic.php index 2ad4fd54c62..764f5f5595e 100644 --- a/app/Models/Forum/Topic.php +++ b/app/Models/Forum/Topic.php @@ -103,6 +103,12 @@ class Topic extends Model implements AfterCommit 'topic_title' => 100, ]; + const PLATFORM_ISSUE_TAGS = [ + 'lazer', + 'stable', + 'web', + ]; + const VIEW_COUNT_INTERVAL = 86400; // 1 day protected $table = 'phpbb_topics'; @@ -811,6 +817,10 @@ public function setIssueTag($tag) { $this->topic_type = static::typeInt($tag === 'confirmed' ? 'sticky' : 'normal'); + if (in_array($tag, static::PLATFORM_ISSUE_TAGS, true)) { + $tag = "osu!{$tag}"; + } + if (!$this->hasIssueTag($tag)) { $this->topic_title = "[{$tag}] {$this->topic_title}"; } @@ -822,6 +832,10 @@ public function unsetIssueTag($tag) { $this->topic_type = static::typeInt($tag === 'resolved' ? 'sticky' : 'normal'); + if (in_array($tag, static::PLATFORM_ISSUE_TAGS, true)) { + $tag = "osu!{$tag}"; + } + $this->topic_title = preg_replace( '/ +/', ' ', @@ -833,6 +847,10 @@ public function unsetIssueTag($tag) public function hasIssueTag($tag) { + if (in_array($tag, static::PLATFORM_ISSUE_TAGS, true)) { + $tag = "osu!{$tag}"; + } + return strpos($this->topic_title, "[{$tag}]") !== false; } diff --git a/app/helpers.php b/app/helpers.php index f83df76e122..588d187bb4d 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1023,12 +1023,12 @@ function issue_icon($issue) return 'fas fa-user'; case 'confirmed': return 'fas fa-exclamation-triangle'; - case 'resolved': - return 'far fa-check-circle'; case 'duplicate': return 'fas fa-copy'; case 'invalid': return 'far fa-times-circle'; + case 'resolved': + return 'far fa-check-circle'; } } @@ -1100,6 +1100,15 @@ function concat_path($paths) return implode('/', array_filter($paths, 'present')); } +function platform_issue_text($issue) +{ + return match ($issue) { + 'lazer' => 'laz', + 'stable' => 'stb', + 'web' => 'web', + }; +} + function proxy_media($url) { if (!present($url)) { diff --git a/resources/lang/en/forum.php b/resources/lang/en/forum.php index cf21ecdb6fb..61bf1789119 100644 --- a/resources/lang/en/forum.php +++ b/resources/lang/en/forum.php @@ -287,6 +287,13 @@ 'to_1_done' => 'Added "invalid" tag', ], + 'issue_tag_lazer' => [ + 'to_0' => 'Remove "osu!lazer" tag', + 'to_0_done' => 'Removed "osu!lazer" tag', + 'to_1' => 'Add "osu!lazer" tag', + 'to_1_done' => 'Added "osu!lazer" tag', + ], + 'issue_tag_resolved' => [ 'to_0' => 'Remove "resolved" tag', 'to_0_done' => 'Removed "resolved" tag', @@ -294,6 +301,20 @@ 'to_1_done' => 'Added "resolved" tag', ], + 'issue_tag_stable' => [ + 'to_0' => 'Remove "osu!stable" tag', + 'to_0_done' => 'Removed "osu!stable" tag', + 'to_1' => 'Add "osu!stable" tag', + 'to_1_done' => 'Added "osu!stable" tag', + ], + + 'issue_tag_web' => [ + 'to_0' => 'Remove "osu!web" tag', + 'to_0_done' => 'Removed "osu!web" tag', + 'to_1' => 'Add "osu!web" tag', + 'to_1_done' => 'Added "osu!web" tag', + ], + 'lock' => [ 'is_locked' => 'This topic is locked and can not be replied to', 'to_0' => 'Unlock topic', diff --git a/resources/views/forum/topics/_issue_tag.blade.php b/resources/views/forum/topics/_issue_tag.blade.php index 4cfdeb216f3..88280e8d7b2 100644 --- a/resources/views/forum/topics/_issue_tag.blade.php +++ b/resources/views/forum/topics/_issue_tag.blade.php @@ -25,6 +25,10 @@ class=" data-method="post" > - + @if (in_array($issueTag, $topic::ISSUE_TAGS, true)) + + @elseif (in_array($issueTag, $topic::PLATFORM_ISSUE_TAGS, true)) + {{ platform_issue_text($issueTag) }} + @endif diff --git a/resources/views/forum/topics/_issue_tag_lazer.blade.php b/resources/views/forum/topics/_issue_tag_lazer.blade.php new file mode 100644 index 00000000000..1b5221f5bfc --- /dev/null +++ b/resources/views/forum/topics/_issue_tag_lazer.blade.php @@ -0,0 +1,7 @@ +{{-- + 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. +--}} +@include('forum.topics._issue_tag', [ + 'issueTag' => 'lazer', +]) diff --git a/resources/views/forum/topics/_issue_tag_stable.blade.php b/resources/views/forum/topics/_issue_tag_stable.blade.php new file mode 100644 index 00000000000..47a298a354d --- /dev/null +++ b/resources/views/forum/topics/_issue_tag_stable.blade.php @@ -0,0 +1,7 @@ +{{-- + 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. +--}} +@include('forum.topics._issue_tag', [ + 'issueTag' => 'stable', +]) diff --git a/resources/views/forum/topics/_issue_tag_web.blade.php b/resources/views/forum/topics/_issue_tag_web.blade.php new file mode 100644 index 00000000000..bc69f483be1 --- /dev/null +++ b/resources/views/forum/topics/_issue_tag_web.blade.php @@ -0,0 +1,7 @@ +{{-- + 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. +--}} +@include('forum.topics._issue_tag', [ + 'issueTag' => 'web', +]) diff --git a/resources/views/forum/topics/_nav.blade.php b/resources/views/forum/topics/_nav.blade.php index 978436ae0b1..aa0dbe0c68e 100644 --- a/resources/views/forum/topics/_nav.blade.php +++ b/resources/views/forum/topics/_nav.blade.php @@ -10,7 +10,7 @@ @include('forum.topics._moderate_move', compact('topic')) @if ($topic->isIssue()) - @foreach ($topic::ISSUE_TAGS as $type) + @foreach (array_merge($topic::ISSUE_TAGS, $topic::PLATFORM_ISSUE_TAGS) as $type) @include("forum.topics._issue_tag_{$type}") @endforeach @endif