From f54c771ec3855b0b6742ae305efdcf2e1c0df0cb Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:04:45 +0800 Subject: [PATCH 001/162] Improve UI of RequestWiki --- includes/HookHandlers/RequestWiki.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c976e645c..f91951102 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -22,6 +22,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-nsfw', 'help-message' => 'requestwiki-help-nsfw', + 'help-inline' => false, 'type' => 'check', ] ); @@ -57,6 +58,18 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'type' => 'url', ] ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'private', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'bio', + newProperties: [ 'help-inline' => false ] + ); } public function onRequestWikiQueueFormDescriptorModify( From 8c026109e0aeac1cf3ec1420efb9cabcceb67c07 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:09:58 +0800 Subject: [PATCH 002/162] Rearrange sections --- includes/HookHandlers/RequestWiki.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index f91951102..b05e969c0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -59,6 +59,30 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'subdomain', + newSection: 'core' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'sitename', + newSection: 'core' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'language', + newSection: 'core' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'private', + newSection: 'configure' + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'private', From 0002c79f78b72be5db227a9762bff5c274410e22 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 13 Oct 2024 22:11:42 +0000 Subject: [PATCH 003/162] CI: lint code to MediaWiki standards Check commit and GitHub actions for more details --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index b05e969c0..bb38c5580 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -76,7 +76,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi fieldKey: 'language', newSection: 'core' ); - + RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'private', From 352244461d3f7e35f4526c971905a97c665743ed Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:16:49 +0800 Subject: [PATCH 004/162] Update --- includes/HookHandlers/RequestWiki.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index bb38c5580..c8bdb3ce0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -83,6 +83,18 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'configure' ); + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'subdomain', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'sitename', + newProperties: [ 'help-inline' => false ] + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'private', From d814eefa5ab8f3980c8a519d8d671683d0b87a1d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:23:51 +0800 Subject: [PATCH 005/162] Move category --- includes/HookHandlers/RequestWiki.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c8bdb3ce0..2522f0db0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -83,6 +83,18 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'configure' ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'category', + newSection: 'configure' + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'category', + newProperties: [ 'help-inline' => false ] + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'subdomain', From 27bd14432afd77d78e7ed458cfd99fbc418c082c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:31:24 +0800 Subject: [PATCH 006/162] Move --- includes/HookHandlers/RequestWiki.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 2522f0db0..018a86da6 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -89,6 +89,18 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'configure' ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'purposes', + newSection: 'info' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'reason', + newSection: 'info' + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'category', From f9f6a1c740c81974f4a68df9a2fa0c8ed6e9d544 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:32:17 +0800 Subject: [PATCH 007/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 018a86da6..bed72cffb 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -91,7 +91,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi RequestWikiFormUtils::moveFieldToSection( $formDescriptor, - fieldKey: 'purposes', + fieldKey: 'purpose', newSection: 'info' ); From 845b97f73fd53ea9ad58705f91cf5053f15e650a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:34:11 +0800 Subject: [PATCH 008/162] Move --- includes/HookHandlers/RequestWiki.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index bed72cffb..a0b1baa9d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -23,6 +23,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-nsfw', 'help-message' => 'requestwiki-help-nsfw', 'help-inline' => false, + 'section' => 'info', 'type' => 'check', ] ); @@ -34,6 +35,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'nsfw', '1' ], + 'section' => 'info', 'type' => 'text', ] ); @@ -44,6 +46,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newKey: 'source', newField: [ 'label-message' => 'requestwiki-label-source', + 'section' => 'info', 'type' => 'check', ] ); @@ -55,6 +58,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'source', '1' ], + 'section' => 'info', 'type' => 'url', ] ); From a18d28caa64e08d50869372b74e14511feb9773e Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:35:55 +0800 Subject: [PATCH 009/162] Move --- includes/HookHandlers/RequestWiki.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index a0b1baa9d..5581f26f7 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -105,6 +105,12 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'info' ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'bio', + newSection: 'info' + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'category', From 12ba437aa2e3cd9844f57e82fb7a9b2678c213fc Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:41:34 +0800 Subject: [PATCH 010/162] Order --- includes/HookHandlers/RequestWiki.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 5581f26f7..21c183143 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -140,6 +140,20 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi fieldKey: 'bio', newProperties: [ 'help-inline' => false ] ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'info', + newOrder: [ + 'purpose', + 'bio', + 'nsfw', + 'source', + 'nsfwtext', + 'sourceurl', + 'reason', + ] + ); } public function onRequestWikiQueueFormDescriptorModify( From d4fd5422f12361f1c864b13a60c301de827b360c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:43:41 +0800 Subject: [PATCH 011/162] Move guidance to info --- includes/HookHandlers/RequestWiki.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 21c183143..b914a8642 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -93,6 +93,12 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'configure' ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'guidance', + newSection: 'info' + ); + RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'purpose', @@ -145,6 +151,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $formDescriptor, section: 'info', newOrder: [ + 'guidance', 'purpose', 'bio', 'nsfw', From 4af9ac5c7fc8da1ed992c7a84ecc55b63af7c11a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:45:31 +0800 Subject: [PATCH 012/162] confirmation --- includes/HookHandlers/RequestWiki.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index b914a8642..7a07680f8 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -117,6 +117,18 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'info' ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'post-reason-guidance', + newSection: 'confirmation' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'agreement', + newSection: 'confirmation' + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'category', From c0d55e37aefb38552e40d05e568eb31cbc778bae Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:46:56 +0800 Subject: [PATCH 013/162] Move --- includes/HookHandlers/RequestWiki.php | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7a07680f8..dd568be4d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -117,6 +117,21 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'info' ); + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'info', + newOrder: [ + 'guidance', + 'purpose', + 'bio', + 'nsfw', + 'source', + 'nsfwtext', + 'sourceurl', + 'reason', + ] + ); + RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'post-reason-guidance', @@ -158,21 +173,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi fieldKey: 'bio', newProperties: [ 'help-inline' => false ] ); - - RequestWikiFormUtils::reorderFieldsInSection( - $formDescriptor, - section: 'info', - newOrder: [ - 'guidance', - 'purpose', - 'bio', - 'nsfw', - 'source', - 'nsfwtext', - 'sourceurl', - 'reason', - ] - ); } public function onRequestWikiQueueFormDescriptorModify( From a7b0d70ab9fa24bb0a34fd099f02f0f1eccf27e2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:48:47 +0800 Subject: [PATCH 014/162] Order --- includes/HookHandlers/RequestWiki.php | 39 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index dd568be4d..7b15a42ef 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -117,21 +117,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'info' ); - RequestWikiFormUtils::reorderFieldsInSection( - $formDescriptor, - section: 'info', - newOrder: [ - 'guidance', - 'purpose', - 'bio', - 'nsfw', - 'source', - 'nsfwtext', - 'sourceurl', - 'reason', - ] - ); - RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'post-reason-guidance', @@ -173,6 +158,30 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi fieldKey: 'bio', newProperties: [ 'help-inline' => false ] ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'info', + newOrder: [ + 'guidance', + 'purpose', + 'bio', + 'nsfw', + 'source', + 'nsfwtext', + 'sourceurl', + 'reason', + ] + ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'confirmation', + newOrder: [ + 'post-reason-guidance', + 'agreement', + ] + ); } public function onRequestWikiQueueFormDescriptorModify( From 912a625e25cd9103e65f76c105196dfab89bcd1b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 06:57:47 +0800 Subject: [PATCH 015/162] Update --- includes/HookHandlers/RequestWiki.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7b15a42ef..23cc43b7d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -15,9 +15,8 @@ class RequestWiki implements { public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'bio', newKey: 'nsfw', newField: [ 'label-message' => 'requestwiki-label-nsfw', @@ -28,9 +27,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'nsfw', newKey: 'nsfwtext', newField: [ 'label-message' => 'requestwiki-label-nsfwtext', @@ -40,9 +38,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'purpose', newKey: 'source', newField: [ 'label-message' => 'requestwiki-label-source', @@ -51,9 +48,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'source', newKey: 'sourceurl', newField: [ 'label-message' => 'requestwiki-label-sourceurl', @@ -63,6 +59,16 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'showadvanced', + newField: [ + 'type' => 'check', + 'label-message' => 'requestwiki-label-showadvanced', + 'section' => 'advanced', + ] + ); + RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'subdomain', From 45067676b25b3e918a17bfa2e532462e91dbde04 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:00:59 +0800 Subject: [PATCH 016/162] Update --- includes/HookHandlers/RequestWiki.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 23cc43b7d..d690ccc4a 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -59,8 +59,9 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::addFieldToEnd( + RequestWikiFormUtils::insertFieldAtBeginningOfSection( $formDescriptor, + section: 'advanced', newKey: 'showadvanced', newField: [ 'type' => 'check', From 1bfacce642053300c594a09da7c92c6e3e6acef8 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:10:48 +0800 Subject: [PATCH 017/162] Add --- includes/HookHandlers/RequestWiki.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index d690ccc4a..acc57543a 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -69,6 +69,23 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'section' => 'advanced', ] ); + + RequestWikiFormUtils::insertFieldAtEndOfSection( + $formDescriptor, + section: 'advanced', + newKey: 'articlepath', + newField: [ + 'type' => 'radio', + 'label-message' => 'miraheze-label-managewiki-article-path', + 'options-messages' => [ + 'miraheze-label-managewiki-article-path-wiki' => '/wiki/$1', + 'miraheze-label-managewiki-article-path-root' => '/$1', + ], + 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'default' => '/wiki/$1', + 'section' => 'advanced', + ] + ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, From 3c50d72735dec92616af3d6744e978dd9deefa12 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 13 Oct 2024 23:13:06 +0000 Subject: [PATCH 018/162] CI: lint code to MediaWiki standards Check commit and GitHub actions for more details --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index acc57543a..0b1fec56e 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -69,7 +69,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'section' => 'advanced', ] ); - + RequestWikiFormUtils::insertFieldAtEndOfSection( $formDescriptor, section: 'advanced', From b318f0c1976aa15f633d06965e55bac4b027e3b0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:17:58 +0800 Subject: [PATCH 019/162] Add --- includes/HookHandlers/RequestWiki.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 0b1fec56e..b6078beff 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -70,6 +70,19 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::insertFieldAfter( + $formDescriptor, + afterKey: 'private', + newKey: 'defaultskin', + newField: [ + 'type' => 'select', + 'label-message' => 'requestwiki-label-defaultskin', + 'options' => [ 'vector-2022' ], + 'default' => 'vector-2022', + 'section' => 'configure', + ] + ); + RequestWikiFormUtils::insertFieldAtEndOfSection( $formDescriptor, section: 'advanced', From ef42b30ddc322ca032569757aa11c8eb1889c560 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:20:36 +0800 Subject: [PATCH 020/162] Order --- includes/HookHandlers/RequestWiki.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index b6078beff..fbd4a649b 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -72,12 +72,12 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi RequestWikiFormUtils::insertFieldAfter( $formDescriptor, - afterKey: 'private', + afterKey: 'category', newKey: 'defaultskin', newField: [ 'type' => 'select', 'label-message' => 'requestwiki-label-defaultskin', - 'options' => [ 'vector-2022' ], + 'options' => [ 'vector-2022' => 'vector-2022' ], 'default' => 'vector-2022', 'section' => 'configure', ] @@ -120,13 +120,13 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi RequestWikiFormUtils::moveFieldToSection( $formDescriptor, - fieldKey: 'private', + fieldKey: 'category', newSection: 'configure' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, - fieldKey: 'category', + fieldKey: 'private', newSection: 'configure' ); From 231280b5d73ab2464840cac3190b8d36e5e74ec9 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:28:10 +0800 Subject: [PATCH 021/162] Order --- includes/HookHandlers/RequestWiki.php | 55 ++++++++++++++++++++------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index fbd4a649b..1f6860779 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -59,20 +59,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::insertFieldAtBeginningOfSection( - $formDescriptor, - section: 'advanced', - newKey: 'showadvanced', - newField: [ - 'type' => 'check', - 'label-message' => 'requestwiki-label-showadvanced', - 'section' => 'advanced', - ] - ); - - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'category', newKey: 'defaultskin', newField: [ 'type' => 'select', @@ -83,7 +71,17 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::insertFieldAtEndOfSection( + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'showadvanced', + newField: [ + 'type' => 'check', + 'label-message' => 'requestwiki-label-showadvanced', + 'section' => 'advanced', + ] + ); + + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, section: 'advanced', newKey: 'articlepath', @@ -196,6 +194,16 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newProperties: [ 'help-inline' => false ] ); + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'core', + newOrder: [ + 'subdomain', + 'sitename', + 'language', + ] + ); + RequestWikiFormUtils::reorderFieldsInSection( $formDescriptor, section: 'info', @@ -211,6 +219,25 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'configure', + newOrder: [ + 'private', + 'category', + 'defaultskin', + ] + ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'advanced', + newOrder: [ + 'showadvanced', + 'articlepath', + ] + ); + RequestWikiFormUtils::reorderFieldsInSection( $formDescriptor, section: 'confirmation', From 58dadd6fe6c2529118f2ef9bf52e32d9f52861f4 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:29:10 +0800 Subject: [PATCH 022/162] Fix --- includes/HookHandlers/RequestWiki.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 1f6860779..124d68e16 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -83,7 +83,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - section: 'advanced', newKey: 'articlepath', newField: [ 'type' => 'radio', From 7cad4da98cae4e2699ed26a9564abb6ae3fd313d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:44:20 +0800 Subject: [PATCH 023/162] Add CreateWikiAfterCreationWithExtraDataHook --- includes/HookHandlers/RequestWiki.php | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 124d68e16..82431117b 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,12 +4,16 @@ use MediaWiki\Language\RawMessage; use MediaWiki\User\User; +use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraData; use Miraheze\CreateWiki\Hooks\RequestWikiFormDescriptorModifyHook; use Miraheze\CreateWiki\Hooks\RequestWikiQueueFormDescriptorModifyHook; use Miraheze\CreateWiki\RequestWiki\RequestWikiFormUtils; use Miraheze\CreateWiki\Services\WikiRequestManager; +use Miraheze\ManageWiki\Helpers\ManageWikiExtensions; +use Miraheze\ManageWiki\Helpers\ManageWikiSettings; class RequestWiki implements + CreateWikiAfterCreationWithExtraDataHook, RequestWikiFormDescriptorModifyHook, RequestWikiQueueFormDescriptorModifyHook { @@ -334,4 +338,33 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); } + + public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $dbname ): void { + $mwSettings = new ManageWikiSettings( $dbname ); + $setList = $mwSettings->list(); + + $mwExtensions = new ManageWikiExtensions( $dbname ); + $extList = $mwExtensions->list(); + + if ( $extraData['articlepath'] !== ( $setList['wgArticlePath'] ?? '/wiki/$1' ) ) { + $mwSettings->modify( [ 'wgArticlePath' => $extraData['articlepath'] ] ); + $mwSettings->commit(); + } + + if ( $extraData['defaultskin'] !== ( $setList['wgDefaultSkin'] ?? 'vector-2022' ) ) { + if ( + !isset( $extList[ $extraData['defaultskin'] ] ) && + !in_array( + $extraData['defaultskin'], + [ 'vector', 'vector-2022' ] + ) + ) { + $mwExtensions->add( $extraData['defaultskin'] ); + $mwExtensions->commit(); + } + + $mwSettings->modify( [ 'wgDefaultSkin' => $extraData['defaultskin'] ] ); + $mwSettings->commit(); + } + } } From 6dccbc1823243b96b43c15be4f5608e37e55b846 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:44:44 +0800 Subject: [PATCH 024/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 82431117b..6cd81f804 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,7 +4,7 @@ use MediaWiki\Language\RawMessage; use MediaWiki\User\User; -use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraData; +use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraDataHook; use Miraheze\CreateWiki\Hooks\RequestWikiFormDescriptorModifyHook; use Miraheze\CreateWiki\Hooks\RequestWikiQueueFormDescriptorModifyHook; use Miraheze\CreateWiki\RequestWiki\RequestWikiFormUtils; From c50679dc8f78dec81e9b2525e2cf033bc929ec0c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:45:51 +0800 Subject: [PATCH 025/162] Add hook --- extension.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extension.json b/extension.json index c45f946b2..a832a9497 100644 --- a/extension.json +++ b/extension.json @@ -79,6 +79,9 @@ "ContributionsToolLinks": { "handler": "Main" }, + "CreateWikiAfterCreationWithExtraData": { + "handler": "RequestWiki" + }, "CreateWikiDeletion": { "handler": "Main" }, From 419a689ea66ae376efea8a886f33ce4c6f599377 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:52:47 +0800 Subject: [PATCH 026/162] Add factory --- includes/HookHandlers/RequestWiki.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 6cd81f804..35fbe0bd0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -2,6 +2,8 @@ namespace Miraheze\MirahezeMagic\HookHandlers; +use MediaWiki\Config\Config; +use MediaWiki\Config\ServiceOptions; use MediaWiki\Language\RawMessage; use MediaWiki\User\User; use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraDataHook; @@ -18,6 +20,25 @@ class RequestWiki implements RequestWikiQueueFormDescriptorModifyHook { + private ServiceOptions $options; + + public function __construct( ServiceOptions $options ) { + $this->options = $options; + } + + public static function factory( + Config $mainConfig + ): self { + return new self( + new ServiceOptions( + [ + 'ManageWikiExtensions', + ], + $mainConfig + ) + ); + } + public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { RequestWikiFormUtils::addFieldToEnd( $formDescriptor, @@ -356,7 +377,7 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string !isset( $extList[ $extraData['defaultskin'] ] ) && !in_array( $extraData['defaultskin'], - [ 'vector', 'vector-2022' ] + $this->options->get( 'ManageWikiExtensions' ) ) ) { $mwExtensions->add( $extraData['defaultskin'] ); From 1c3932662f85928888c7108105dfca6314f65d79 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:53:44 +0800 Subject: [PATCH 027/162] Add factory --- extension.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extension.json b/extension.json index a832a9497..81d8aee65 100644 --- a/extension.json +++ b/extension.json @@ -152,7 +152,11 @@ ] }, "RequestWiki": { - "class": "Miraheze\\MirahezeMagic\\HookHandlers\\RequestWiki" + "class": "Miraheze\\MirahezeMagic\\HookHandlers\\RequestWiki", + "factory": "Miraheze\\MirahezeMagic\\HookHandlers\\RequestWiki::factory", + "services": [ + "MainConfig" + ] } }, "config": { From 1989d8e372a2bf0eefa3c9a7bb0a64684ada6de0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 07:59:01 +0800 Subject: [PATCH 028/162] Add MirahezeMagicRequestWikiSkins --- includes/HookHandlers/RequestWiki.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 35fbe0bd0..482b0a0ce 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -33,6 +33,7 @@ public static function factory( new ServiceOptions( [ 'ManageWikiExtensions', + 'MirahezeMagicRequestWikiSkins', ], $mainConfig ) @@ -90,7 +91,10 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'type' => 'select', 'label-message' => 'requestwiki-label-defaultskin', - 'options' => [ 'vector-2022' => 'vector-2022' ], + 'options' => array_combine( + $this->options->get( 'MirahezeMagicRequestWikiSkins' ), + $this->options->get( 'MirahezeMagicRequestWikiSkins' ) + ), 'default' => 'vector-2022', 'section' => 'configure', ] From 97c085ce4ad3e9ac0d1c69639599342ec15d2da7 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 08:00:56 +0800 Subject: [PATCH 029/162] Add MirahezeMagicRequestWikiSkins --- extension.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extension.json b/extension.json index 81d8aee65..5b026a6c7 100644 --- a/extension.json +++ b/extension.json @@ -168,6 +168,10 @@ "description": "Array. Memcached servers to use for clearing memcached keys when a wiki is deleted or renamed.", "value": [] }, + "MirahezeMagicRequestWikiSkins": { + "description": "Array. Skins to allow to select directly from RequestWiki.", + "value": [ "vector", "vector-2022" ] + }, "MirahezeReportsBlockAlertKeywords": { "description": "Array. Words in block reasons which trigger a report being sent to TSPortal.", "value": [] From 8a50b929a4854e9d1b3ee10c2ca2934a5e3e4022 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 08:06:09 +0800 Subject: [PATCH 030/162] Add --- includes/HookHandlers/RequestWiki.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 482b0a0ce..381424f7d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -126,6 +126,22 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'defaultextensions', + newField: [ + 'type' => 'multiselect', + 'label-message' => 'requestwiki-label-defaultextensions', + 'help-message' => 'requestwiki-help-defaultextensions', + 'help-inline' => false, + 'options' => [ 'test' ], + 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'default' => [], + 'dropdown' => true, + 'section' => 'advanced', + ] + ); + RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'subdomain', @@ -263,6 +279,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newOrder: [ 'showadvanced', 'articlepath', + 'defaultextensions', ] ); From 66934941a8f6821c34b31f65f0dd8f26b1c6c6a4 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 08:42:02 +0800 Subject: [PATCH 031/162] Add MirahezeMagicRequestWikiExtensions --- includes/HookHandlers/RequestWiki.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 381424f7d..438418c33 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -26,13 +26,12 @@ public function __construct( ServiceOptions $options ) { $this->options = $options; } - public static function factory( - Config $mainConfig - ): self { + public static function factory( Config $mainConfig ): self { return new self( new ServiceOptions( [ 'ManageWikiExtensions', + 'MirahezeMagicRequestWikiExtensions', 'MirahezeMagicRequestWikiSkins', ], $mainConfig @@ -134,9 +133,11 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-defaultextensions', 'help-message' => 'requestwiki-help-defaultextensions', 'help-inline' => false, - 'options' => [ 'test' ], + 'options' => array_combine( + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) + ), 'hide-if' => [ '!==', 'showadvanced', '1' ], - 'default' => [], 'dropdown' => true, 'section' => 'advanced', ] From 38bf04d75629682d7d3599c2785a2a553110ccd0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 08:43:22 +0800 Subject: [PATCH 032/162] Add MirahezeMagicRequestWikiExtensions --- extension.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extension.json b/extension.json index 5b026a6c7..c6f522637 100644 --- a/extension.json +++ b/extension.json @@ -168,6 +168,10 @@ "description": "Array. Memcached servers to use for clearing memcached keys when a wiki is deleted or renamed.", "value": [] }, + "MirahezeMagicRequestWikiExtensions": { + "description": "Array. Extensions to allow to select directly from RequestWiki.", + "value": [] + }, "MirahezeMagicRequestWikiSkins": { "description": "Array. Skins to allow to select directly from RequestWiki.", "value": [ "vector", "vector-2022" ] From b0f8f3bd6b9360ee2526454108cb756d0596e867 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 08:46:47 +0800 Subject: [PATCH 033/162] Add --- includes/HookHandlers/RequestWiki.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 438418c33..9fd91d7c0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -409,5 +409,10 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwSettings->modify( [ 'wgDefaultSkin' => $extraData['defaultskin'] ] ); $mwSettings->commit(); } + + if ( $extraData['defaultextensions'] ?? [] ) { + $mwExtensions->add( $extraData['defaultextensions'] ); + $mwExtensions->commit(); + } } } From 35e7196235c3e6d36fe8d39bd348e1ffd6b32b49 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 08:49:37 +0800 Subject: [PATCH 034/162] Add pageimages --- extension.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.json b/extension.json index c6f522637..c97e21ed1 100644 --- a/extension.json +++ b/extension.json @@ -170,7 +170,7 @@ }, "MirahezeMagicRequestWikiExtensions": { "description": "Array. Extensions to allow to select directly from RequestWiki.", - "value": [] + "value": [ "pageimages" ] }, "MirahezeMagicRequestWikiSkins": { "description": "Array. Skins to allow to select directly from RequestWiki.", From 228140fcf74cc4cb2e677429b7a3be38ff55aa30 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:24:41 -0600 Subject: [PATCH 035/162] Test sub section --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 9fd91d7c0..802dfec08 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -306,7 +306,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'label-message' => 'requestwiki-label-nsfw', 'type' => 'check', - 'section' => 'editing', + 'section' => 'editing/info', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), ] ); From 3d671082d540479877f000c2c230a01d4ac45469 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:38:30 -0600 Subject: [PATCH 036/162] Update queue --- includes/HookHandlers/RequestWiki.php | 241 ++++++++++++++++++++++---- 1 file changed, 211 insertions(+), 30 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 802dfec08..2f3ca1dc5 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -299,72 +299,253 @@ public function onRequestWikiQueueFormDescriptorModify( User $user, WikiRequestManager $wikiRequestManager ): void { - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'edit-bio', newKey: 'edit-nsfw', newField: [ 'label-message' => 'requestwiki-label-nsfw', - 'type' => 'check', + 'help-message' => 'requestwiki-help-nsfw', + 'help-inline' => false, 'section' => 'editing/info', + 'type' => 'check', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), ] ); - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'edit-nsfw', newKey: 'edit-nsfwtext', newField: [ 'label-message' => 'requestwiki-label-nsfwtext', - 'type' => 'text', - 'section' => 'editing', 'hide-if' => [ '!==', 'edit-nsfw', '1' ], + 'section' => 'editing/info', + 'type' => 'text', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfwtext' ), ] ); - $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); - $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); - - RequestWikiFormUtils::insertFieldAfter( - $formDescriptor, - afterKey: 'details-description', - newKey: 'details-nsfw', - newField: [ - 'label-message' => 'requestwiki-label-nsfw', - 'type' => 'info', - 'section' => 'details', - 'raw' => true, - 'default' => $nsfwMessage->parse(), - ] - ); - - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'edit-purpose', newKey: 'edit-source', newField: [ 'label-message' => 'requestwiki-label-source', + 'section' => 'editing/info', 'type' => 'check', - 'section' => 'editing', 'default' => $wikiRequestManager->getExtraFieldData( 'source' ), ] ); - RequestWikiFormUtils::insertFieldAfter( + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, - afterKey: 'edit-source', newKey: 'edit-sourceurl', newField: [ 'label-message' => 'requestwiki-label-sourceurl', - 'type' => 'url', - 'section' => 'editing', 'hide-if' => [ '!==', 'edit-source', '1' ], + 'section' => 'editing/info', + 'type' => 'url', 'default' => $wikiRequestManager->getExtraFieldData( 'sourceurl' ), ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-defaultskin', + newField: [ + 'type' => 'select', + 'label-message' => 'requestwiki-label-defaultskin', + 'options' => array_combine( + $this->options->get( 'MirahezeMagicRequestWikiSkins' ), + $this->options->get( 'MirahezeMagicRequestWikiSkins' ) + ), + 'section' => 'editing/configure', + 'default' => $wikiRequestManager->getExtraFieldData( 'defaultskin' ), + ] + ); + + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-showadvanced', + newField: [ + 'type' => 'check', + 'label-message' => 'requestwiki-label-showadvanced', + 'section' => 'editing/advanced', + 'default' => $wikiRequestManager->getExtraFieldData( 'showadvanced' ), + ] + ); + + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-articlepath', + newField: [ + 'type' => 'radio', + 'label-message' => 'miraheze-label-managewiki-article-path', + 'options-messages' => [ + 'miraheze-label-managewiki-article-path-wiki' => '/wiki/$1', + 'miraheze-label-managewiki-article-path-root' => '/$1', + ], + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], + 'section' => 'editing/advanced', + 'default' => $wikiRequestManager->getExtraFieldData( 'articlepath' ), + ] + ); + + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-defaultextensions', + newField: [ + 'type' => 'multiselect', + 'label-message' => 'requestwiki-label-defaultextensions', + 'help-message' => 'requestwiki-help-defaultextensions', + 'help-inline' => false, + 'options' => array_combine( + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) + ), + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], + 'dropdown' => true, + 'section' => 'editing/advanced', + 'default' => $wikiRequestManager->getExtraFieldData( 'defaultextensions' ), + ] + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-subdomain', + newSection: 'editing/core' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-sitename', + newSection: 'editing/core' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-language', + newSection: 'editing/core' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-category', + newSection: 'editing/configure' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-private', + newSection: 'editing/configure' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-purpose', + newSection: 'editing/info' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-reason', + newSection: 'editing/info' + ); + + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'edit-bio', + newSection: 'editing/info' + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'edit-category', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'edit-subdomain', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'edit-sitename', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'edit-private', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'edit-bio', + newProperties: [ 'help-inline' => false ] + ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'editing/core', + newOrder: [ + 'edit-subdomain', + 'edit-sitename', + 'edit-language', + ] + ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'editing/info', + newOrder: [ + 'edit-purpose', + 'edit-bio', + 'edit-nsfw', + 'edit-source', + 'edit-nsfwtext', + 'edit-sourceurl', + 'edit-reason', + ] + ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'editing/configure', + newOrder: [ + 'edit-private', + 'edit-category', + 'edit-defaultskin', + ] + ); + + RequestWikiFormUtils::reorderFieldsInSection( + $formDescriptor, + section: 'editing/advanced', + newOrder: [ + 'edit-showadvanced', + 'edit-articlepath', + 'edit-defaultextensions', + ] + ); + + $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); + $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + + RequestWikiFormUtils::insertFieldAfter( + $formDescriptor, + afterKey: 'details-description', + newKey: 'details-nsfw', + newField: [ + 'label-message' => 'requestwiki-label-nsfw', + 'type' => 'info', + 'section' => 'details', + 'raw' => true, + 'default' => $nsfwMessage->parse(), + ] + ); + $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); From 31be8f6f5db12913db28a6c20f824f370bc4e993 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:40:46 -0600 Subject: [PATCH 037/162] Fix --- includes/HookHandlers/RequestWiki.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 2f3ca1dc5..ae386ee6b 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -410,7 +410,7 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::moveFieldToSection( $formDescriptor, - fieldKey: 'edit-subdomain', + fieldKey: 'edit-url', newSection: 'editing/core' ); @@ -446,7 +446,7 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::moveFieldToSection( $formDescriptor, - fieldKey: 'edit-reason', + fieldKey: 'edit-description', newSection: 'editing/info' ); @@ -490,7 +490,7 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, section: 'editing/core', newOrder: [ - 'edit-subdomain', + 'edit-url', 'edit-sitename', 'edit-language', ] @@ -506,7 +506,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'edit-source', 'edit-nsfwtext', 'edit-sourceurl', - 'edit-reason', + 'edit-description', ] ); From 0fb3f53fd1b6ffc4c5f5838cfd7a39a579803ab6 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:44:13 -0600 Subject: [PATCH 038/162] Fix --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ae386ee6b..0906968fb 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -527,6 +527,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'edit-showadvanced', 'edit-articlepath', 'edit-defaultextensions', + 'submit-edit', ] ); From cd7ff0b487c1e01f86227af8487172ae47f82660 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:46:26 -0600 Subject: [PATCH 039/162] Fix --- includes/HookHandlers/RequestWiki.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 0906968fb..7ab406295 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -456,6 +456,12 @@ public function onRequestWikiQueueFormDescriptorModify( newSection: 'editing/info' ); + RequestWikiFormUtils::moveFieldToSection( + $formDescriptor, + fieldKey: 'submit-edit', + newSection: 'editing/advanced' + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'edit-category', From 8bb487ef3b2101dcd5d01f7ce3ea0972118658d6 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:53:44 -0600 Subject: [PATCH 040/162] Try section ordering --- includes/HookHandlers/RequestWiki.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7ab406295..06cbd3a8b 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -470,7 +470,7 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::updateFieldProperties( $formDescriptor, - fieldKey: 'edit-subdomain', + fieldKey: 'edit-url', newProperties: [ 'help-inline' => false ] ); @@ -537,6 +537,14 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); + RequestWikiFormUtils::reorderSections( + $formDescriptor, + newSectionOrder: [ + 'details', + 'editing', + ] + ); + $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); From fba6ec643e07342e11f787c46f83e49414b20a04 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:54:49 -0600 Subject: [PATCH 041/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 06cbd3a8b..0530e55ee 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -541,7 +541,7 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, newSectionOrder: [ 'details', - 'editing', + 'editing/core', ] ); From 741b8673f91e79963a9ee5db3217f0c027684ab5 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:55:58 -0600 Subject: [PATCH 042/162] Fix --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 0530e55ee..80a855a47 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -541,6 +541,7 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, newSectionOrder: [ 'details', + 'comments', 'editing/core', ] ); From 6405c2221091832786c01646994d4276bb1a38c2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 11:59:30 -0600 Subject: [PATCH 043/162] Remove --- includes/HookHandlers/RequestWiki.php | 30 --------------------------- 1 file changed, 30 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 80a855a47..17feac542 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -462,36 +462,6 @@ public function onRequestWikiQueueFormDescriptorModify( newSection: 'editing/advanced' ); - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'edit-category', - newProperties: [ 'help-inline' => false ] - ); - - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'edit-url', - newProperties: [ 'help-inline' => false ] - ); - - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'edit-sitename', - newProperties: [ 'help-inline' => false ] - ); - - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'edit-private', - newProperties: [ 'help-inline' => false ] - ); - - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'edit-bio', - newProperties: [ 'help-inline' => false ] - ); - RequestWikiFormUtils::reorderFieldsInSection( $formDescriptor, section: 'editing/core', From 71cfb7abb297b425d43b12b6b3a758c4d9398ca2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:03:31 -0600 Subject: [PATCH 044/162] Fix --- includes/HookHandlers/RequestWiki.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 17feac542..fb5ef5dc6 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -358,7 +358,7 @@ public function onRequestWikiQueueFormDescriptorModify( $this->options->get( 'MirahezeMagicRequestWikiSkins' ) ), 'section' => 'editing/configure', - 'default' => $wikiRequestManager->getExtraFieldData( 'defaultskin' ), + 'default' => $wikiRequestManager->getExtraFieldData( 'defaultskin' ) ?? 'vector-2022', ] ); @@ -385,7 +385,7 @@ public function onRequestWikiQueueFormDescriptorModify( ], 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'section' => 'editing/advanced', - 'default' => $wikiRequestManager->getExtraFieldData( 'articlepath' ), + 'default' => $wikiRequestManager->getExtraFieldData( 'articlepath' ) ?? '/wiki/$1', ] ); @@ -564,7 +564,7 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string if ( $extraData['defaultskin'] !== ( $setList['wgDefaultSkin'] ?? 'vector-2022' ) ) { if ( !isset( $extList[ $extraData['defaultskin'] ] ) && - !in_array( + in_array( $extraData['defaultskin'], $this->options->get( 'ManageWikiExtensions' ) ) From 1430ab6c5e90b73d315a29394848779eff246c5c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:04:59 -0600 Subject: [PATCH 045/162] - --- includes/HookHandlers/RequestWiki.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index fb5ef5dc6..df0b772d9 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -304,8 +304,6 @@ public function onRequestWikiQueueFormDescriptorModify( newKey: 'edit-nsfw', newField: [ 'label-message' => 'requestwiki-label-nsfw', - 'help-message' => 'requestwiki-help-nsfw', - 'help-inline' => false, 'section' => 'editing/info', 'type' => 'check', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), From 1fa3cdac4f3352be81fb60a36b4d7fa4cac8d1c9 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:08:48 -0600 Subject: [PATCH 046/162] Try /basic --- includes/HookHandlers/RequestWiki.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index df0b772d9..5d17852bb 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -304,7 +304,7 @@ public function onRequestWikiQueueFormDescriptorModify( newKey: 'edit-nsfw', newField: [ 'label-message' => 'requestwiki-label-nsfw', - 'section' => 'editing/info', + 'section' => 'editing/basic', 'type' => 'check', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), ] @@ -316,7 +316,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'edit-nsfw', '1' ], - 'section' => 'editing/info', + 'section' => 'editing/basic', 'type' => 'text', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfwtext' ), ] @@ -327,7 +327,7 @@ public function onRequestWikiQueueFormDescriptorModify( newKey: 'edit-source', newField: [ 'label-message' => 'requestwiki-label-source', - 'section' => 'editing/info', + 'section' => 'editing/basic', 'type' => 'check', 'default' => $wikiRequestManager->getExtraFieldData( 'source' ), ] @@ -339,7 +339,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'edit-source', '1' ], - 'section' => 'editing/info', + 'section' => 'editing/basic', 'type' => 'url', 'default' => $wikiRequestManager->getExtraFieldData( 'sourceurl' ), ] @@ -393,8 +393,6 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'multiselect', 'label-message' => 'requestwiki-label-defaultextensions', - 'help-message' => 'requestwiki-help-defaultextensions', - 'help-inline' => false, 'options' => array_combine( $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) @@ -439,19 +437,19 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'edit-purpose', - newSection: 'editing/info' + newSection: 'editing/basic' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'edit-description', - newSection: 'editing/info' + newSection: 'editing/basic' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'edit-bio', - newSection: 'editing/info' + newSection: 'editing/basic' ); RequestWikiFormUtils::moveFieldToSection( @@ -472,7 +470,7 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::reorderFieldsInSection( $formDescriptor, - section: 'editing/info', + section: 'editing/basic', newOrder: [ 'edit-purpose', 'edit-bio', From 3be66efb2f7adeda1ba1bfcda22c0cdd3a789233 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:41:41 -0600 Subject: [PATCH 047/162] Add mainpageroot --- includes/HookHandlers/RequestWiki.php | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 5d17852bb..ce2514cb8 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -108,6 +108,17 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'section' => 'advanced', ] ); + + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'mainpageroot', + newField: [ + 'type' => 'check', + 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', + 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'section' => 'advanced', + ] + ); RequestWikiFormUtils::addFieldToEnd( $formDescriptor, @@ -279,6 +290,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi section: 'advanced', newOrder: [ 'showadvanced', + 'mainpageroot', 'articlepath', 'defaultextensions', ] @@ -371,6 +383,18 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-mainpageroot', + newField: [ + 'type' => 'check', + 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], + 'section' => 'advanced', + 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), + ] + ); + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'edit-articlepath', @@ -497,6 +521,7 @@ public function onRequestWikiQueueFormDescriptorModify( section: 'editing/advanced', newOrder: [ 'edit-showadvanced', + 'edit-mainpageroot', 'edit-articlepath', 'edit-defaultextensions', 'submit-edit', @@ -557,6 +582,11 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwSettings->commit(); } + if ( $extraData['mainpageroot'] !== ( $setList['wgMainPageIsDomainRoot'] ?? false ) ) { + $mwSettings->modify( [ 'wgMainPageIsDomainRoot' => $extraData['mainpageroot'] ] ); + $mwSettings->commit(); + } + if ( $extraData['defaultskin'] !== ( $setList['wgDefaultSkin'] ?? 'vector-2022' ) ) { if ( !isset( $extList[ $extraData['defaultskin'] ] ) && From 2e8b516ea24919295e8778f1f0b29a71860b90ab Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:42:31 -0600 Subject: [PATCH 048/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ce2514cb8..28ca97389 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -390,7 +390,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], - 'section' => 'advanced', + 'section' => 'editing/advanced', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), ] ); From 1f197fc692bad2647977bf71bd28362e492ef806 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 14 Oct 2024 19:44:18 +0000 Subject: [PATCH 049/162] CI: lint code to MediaWiki standards Check commit and GitHub actions for more details --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 28ca97389..e93a6b8ac 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -108,7 +108,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'section' => 'advanced', ] ); - + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'mainpageroot', From ec9bea48e6792a1bb80e2420f9a84fb3ff45028f Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:47:25 -0600 Subject: [PATCH 050/162] Try new --- includes/HookHandlers/RequestWiki.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index e93a6b8ac..8577bd0e4 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -149,6 +149,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) ), 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'cssclass' => 'createwiki-infuse', 'dropdown' => true, 'section' => 'advanced', ] @@ -376,7 +377,7 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, newKey: 'edit-showadvanced', newField: [ - 'type' => 'check', + 'type' => 'toggle', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', 'default' => $wikiRequestManager->getExtraFieldData( 'showadvanced' ), From 41e11a279111ccf3805f30251ad198ed2b171bdf Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 13:53:56 -0600 Subject: [PATCH 051/162] Update --- includes/HookHandlers/RequestWiki.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8577bd0e4..446c64ad6 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,6 +4,7 @@ use MediaWiki\Config\Config; use MediaWiki\Config\ServiceOptions; +use MediaWiki\HTMLForm\Field\HTMLToggleSwitchField; use MediaWiki\Language\RawMessage; use MediaWiki\User\User; use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraDataHook; @@ -48,6 +49,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'help-message' => 'requestwiki-help-nsfw', 'help-inline' => false, 'section' => 'info', + 'cssclass' => 'createwiki-infuse', 'type' => 'check', ] ); @@ -59,6 +61,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'nsfw', '1' ], 'section' => 'info', + 'cssclass' => 'createwiki-infuse', 'type' => 'text', ] ); @@ -69,6 +72,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-source', 'section' => 'info', + 'cssclass' => 'createwiki-infuse', 'type' => 'check', ] ); @@ -80,6 +84,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'source', '1' ], 'section' => 'info', + 'cssclass' => 'createwiki-infuse', 'type' => 'url', ] ); @@ -95,6 +100,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $this->options->get( 'MirahezeMagicRequestWikiSkins' ) ), 'default' => 'vector-2022', + 'cssclass' => 'createwiki-infuse', 'section' => 'configure', ] ); @@ -103,7 +109,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $formDescriptor, newKey: 'showadvanced', newField: [ - 'type' => 'check', + 'class' => HTMLToggleSwitchField::class, + 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'advanced', ] @@ -116,6 +123,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'cssclass' => 'createwiki-infuse', 'section' => 'advanced', ] ); @@ -131,6 +139,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'miraheze-label-managewiki-article-path-root' => '/$1', ], 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'cssclass' => 'createwiki-infuse', 'default' => '/wiki/$1', 'section' => 'advanced', ] @@ -319,6 +328,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'requestwiki-label-nsfw', 'section' => 'editing/basic', 'type' => 'check', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), ] ); @@ -331,6 +341,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'hide-if' => [ '!==', 'edit-nsfw', '1' ], 'section' => 'editing/basic', 'type' => 'text', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfwtext' ), ] ); @@ -342,6 +353,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'requestwiki-label-source', 'section' => 'editing/basic', 'type' => 'check', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'source' ), ] ); @@ -354,6 +366,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'hide-if' => [ '!==', 'edit-source', '1' ], 'section' => 'editing/basic', 'type' => 'url', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'sourceurl' ), ] ); @@ -369,6 +382,7 @@ public function onRequestWikiQueueFormDescriptorModify( $this->options->get( 'MirahezeMagicRequestWikiSkins' ) ), 'section' => 'editing/configure', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'defaultskin' ) ?? 'vector-2022', ] ); @@ -377,7 +391,8 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, newKey: 'edit-showadvanced', newField: [ - 'type' => 'toggle', + 'class' => HTMLToggleSwitchField::class, + 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', 'default' => $wikiRequestManager->getExtraFieldData( 'showadvanced' ), @@ -392,6 +407,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'section' => 'editing/advanced', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), ] ); @@ -408,6 +424,7 @@ public function onRequestWikiQueueFormDescriptorModify( ], 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'section' => 'editing/advanced', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'articlepath' ) ?? '/wiki/$1', ] ); @@ -425,6 +442,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'dropdown' => true, 'section' => 'editing/advanced', + 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'defaultextensions' ), ] ); From 49ca81bc7307e9e6825cbe206195fd384dca581f Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:06:25 -0600 Subject: [PATCH 052/162] Don't show on old requests --- includes/HookHandlers/RequestWiki.php | 66 +++++++++++++++------------ 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 446c64ad6..231140131 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -556,37 +556,43 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); - $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); - - RequestWikiFormUtils::insertFieldAfter( - $formDescriptor, - afterKey: 'details-description', - newKey: 'details-nsfw', - newField: [ - 'label-message' => 'requestwiki-label-nsfw', - 'type' => 'info', - 'section' => 'details', - 'raw' => true, - 'default' => $nsfwMessage->parse(), - ] - ); - - $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); - $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + // Don't show on old requests before it was added + if ( $wikiRequestManager->getExtraFieldData( 'nsfw' ) === null ) { + $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); + $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + + RequestWikiFormUtils::insertFieldAfter( + $formDescriptor, + afterKey: 'details-description', + newKey: 'details-nsfw', + newField: [ + 'label-message' => 'requestwiki-label-nsfw', + 'type' => 'info', + 'section' => 'details', + 'raw' => true, + 'default' => $nsfwMessage->parse(), + ] + ); + } - RequestWikiFormUtils::insertFieldAfter( - $formDescriptor, - afterKey: 'details-purpose', - newKey: 'details-source', - newField: [ - 'label-message' => 'requestwiki-label-source', - 'type' => 'info', - 'section' => 'details', - 'raw' => true, - 'default' => $sourceMessage->parse(), - ] - ); + // Don't show on old requests before it was added + if ( $wikiRequestManager->getExtraFieldData( 'source' ) === null ) { + $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); + $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + + RequestWikiFormUtils::insertFieldAfter( + $formDescriptor, + afterKey: 'details-purpose', + newKey: 'details-source', + newField: [ + 'label-message' => 'requestwiki-label-source', + 'type' => 'info', + 'section' => 'details', + 'raw' => true, + 'default' => $sourceMessage->parse(), + ] + ); + } } public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $dbname ): void { From ba477160f459934bcdff490484639f5cc9027427 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:07:40 -0600 Subject: [PATCH 053/162] Fix --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 231140131..d9913988d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -557,7 +557,7 @@ public function onRequestWikiQueueFormDescriptorModify( ); // Don't show on old requests before it was added - if ( $wikiRequestManager->getExtraFieldData( 'nsfw' ) === null ) { + if ( $wikiRequestManager->getExtraFieldData( 'nsfw' ) !== null ) { $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); @@ -576,7 +576,7 @@ public function onRequestWikiQueueFormDescriptorModify( } // Don't show on old requests before it was added - if ( $wikiRequestManager->getExtraFieldData( 'source' ) === null ) { + if ( $wikiRequestManager->getExtraFieldData( 'source' ) !== null ) { $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); From a3b16b8f772662832933ebb028a49bb6137e7bf8 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:11:41 -0600 Subject: [PATCH 054/162] Revert --- includes/HookHandlers/RequestWiki.php | 66 ++++++++++++--------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index d9913988d..446c64ad6 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -556,43 +556,37 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - // Don't show on old requests before it was added - if ( $wikiRequestManager->getExtraFieldData( 'nsfw' ) !== null ) { - $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); - $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); - - RequestWikiFormUtils::insertFieldAfter( - $formDescriptor, - afterKey: 'details-description', - newKey: 'details-nsfw', - newField: [ - 'label-message' => 'requestwiki-label-nsfw', - 'type' => 'info', - 'section' => 'details', - 'raw' => true, - 'default' => $nsfwMessage->parse(), - ] - ); - } + $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); + $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); - // Don't show on old requests before it was added - if ( $wikiRequestManager->getExtraFieldData( 'source' ) !== null ) { - $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); - $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); - - RequestWikiFormUtils::insertFieldAfter( - $formDescriptor, - afterKey: 'details-purpose', - newKey: 'details-source', - newField: [ - 'label-message' => 'requestwiki-label-source', - 'type' => 'info', - 'section' => 'details', - 'raw' => true, - 'default' => $sourceMessage->parse(), - ] - ); - } + RequestWikiFormUtils::insertFieldAfter( + $formDescriptor, + afterKey: 'details-description', + newKey: 'details-nsfw', + newField: [ + 'label-message' => 'requestwiki-label-nsfw', + 'type' => 'info', + 'section' => 'details', + 'raw' => true, + 'default' => $nsfwMessage->parse(), + ] + ); + + $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); + $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + + RequestWikiFormUtils::insertFieldAfter( + $formDescriptor, + afterKey: 'details-purpose', + newKey: 'details-source', + newField: [ + 'label-message' => 'requestwiki-label-source', + 'type' => 'info', + 'section' => 'details', + 'raw' => true, + 'default' => $sourceMessage->parse(), + ] + ); } public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $dbname ): void { From d5fddcd9acdd888f47bffa58b976b26ace9881ff Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:14:31 -0600 Subject: [PATCH 055/162] Add required --- includes/HookHandlers/RequestWiki.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 446c64ad6..8387e2ae5 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -60,8 +60,9 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'nsfw', '1' ], - 'section' => 'info', 'cssclass' => 'createwiki-infuse', + 'required' => true, + 'section' => 'info', 'type' => 'text', ] ); @@ -83,8 +84,9 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'source', '1' ], - 'section' => 'info', 'cssclass' => 'createwiki-infuse', + 'required' => true, + 'section' => 'info', 'type' => 'url', ] ); @@ -339,9 +341,10 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'edit-nsfw', '1' ], + 'cssclass' => 'createwiki-infuse', 'section' => 'editing/basic', + 'required' => true, 'type' => 'text', - 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfwtext' ), ] ); @@ -364,9 +367,10 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'edit-source', '1' ], + 'cssclass' => 'createwiki-infuse', 'section' => 'editing/basic', + 'required' => true, 'type' => 'url', - 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'sourceurl' ), ] ); From 9df064b34a06fde296d19ce9a0e47f945c3aee1d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:40:12 -0600 Subject: [PATCH 056/162] Add wddescription --- includes/HookHandlers/RequestWiki.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8387e2ae5..1ccd9cd47 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -107,6 +107,19 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'wddescription', + newField: [ + 'type' => 'text', + 'autosize' => true, + 'maxlength' => 512, + 'label-message' => 'managewiki-label-description', + 'cssclass' => 'createwiki-infuse', + 'section' => 'configure', + ] + ); + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'showadvanced', From e8f790c3baed7c68114b98a729e0e731bfa2f6ce Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:42:02 -0600 Subject: [PATCH 057/162] Fix --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 1ccd9cd47..167029d8f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -111,8 +111,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $formDescriptor, newKey: 'wddescription', newField: [ - 'type' => 'text', - 'autosize' => true, + 'type' => 'textarea', + 'rows' => 2, 'maxlength' => 512, 'label-message' => 'managewiki-label-description', 'cssclass' => 'createwiki-infuse', From 6047a82f15982fb43bbd0609a5463867dd075b5f Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:46:05 -0600 Subject: [PATCH 058/162] Add --- includes/HookHandlers/RequestWiki.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 167029d8f..299cb949a 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -111,8 +111,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $formDescriptor, newKey: 'wddescription', newField: [ - 'type' => 'textarea', - 'rows' => 2, + 'type' => 'text', 'maxlength' => 512, 'label-message' => 'managewiki-label-description', 'cssclass' => 'createwiki-infuse', @@ -307,6 +306,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'private', 'category', 'defaultskin', + 'wddescription', ] ); @@ -404,6 +404,18 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-wddescription', + newField: [ + 'type' => 'text', + 'maxlength' => 512, + 'label-message' => 'managewiki-label-description', + 'cssclass' => 'createwiki-infuse', + 'section' => 'editing/configure', + ] + ); + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'edit-showadvanced', @@ -549,6 +561,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'edit-private', 'edit-category', 'edit-defaultskin', + 'edit-wddescription', ] ); From 43b4502e354f4bf85b01b2dc37aab87dd121c7da Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 14:50:07 -0600 Subject: [PATCH 059/162] Add --- includes/HookHandlers/RequestWiki.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 299cb949a..e609eda72 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -411,8 +411,9 @@ public function onRequestWikiQueueFormDescriptorModify( 'type' => 'text', 'maxlength' => 512, 'label-message' => 'managewiki-label-description', - 'cssclass' => 'createwiki-infuse', 'section' => 'editing/configure', + 'cssclass' => 'createwiki-infuse', + 'default' => $wikiRequestManager->getExtraFieldData( 'wddescription' ), ] ); @@ -636,6 +637,11 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwSettings->commit(); } + if ( $extraData['wddescription'] !== ( $setList['wgWikiDiscoverDescription'] ?? '' ) ) { + $mwSettings->modify( [ 'wgWikiDiscoverDescription' => $extraData['wddescription'] ] ); + $mwSettings->commit(); + } + if ( $extraData['defaultskin'] !== ( $setList['wgDefaultSkin'] ?? 'vector-2022' ) ) { if ( !isset( $extList[ $extraData['defaultskin'] ] ) && From cb6194e7257b283749a5858fc8aeeccc55382dc0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:17:32 -0600 Subject: [PATCH 060/162] IconWidget --- includes/HookHandlers/RequestWiki.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index e609eda72..96131d154 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -14,6 +14,7 @@ use Miraheze\CreateWiki\Services\WikiRequestManager; use Miraheze\ManageWiki\Helpers\ManageWikiExtensions; use Miraheze\ManageWiki\Helpers\ManageWikiSettings; +use OOUI\IconWidget; class RequestWiki implements CreateWikiAfterCreationWithExtraDataHook, @@ -588,7 +589,8 @@ public function onRequestWikiQueueFormDescriptorModify( ); $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); - $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + // $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); + $nsfwMessage = new IconWidget( [ 'icon' => 'check' ] ) . 'Yes'; RequestWikiFormUtils::insertFieldAfter( $formDescriptor, From 91e0cc075e5c37319924b5fe9c2ec8e4786d91cc Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:19:20 -0600 Subject: [PATCH 061/162] Try --- includes/HookHandlers/RequestWiki.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 96131d154..24b6a721d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,6 +4,7 @@ use MediaWiki\Config\Config; use MediaWiki\Config\ServiceOptions; +use MediaWiki\Context\RequestContext; use MediaWiki\HTMLForm\Field\HTMLToggleSwitchField; use MediaWiki\Language\RawMessage; use MediaWiki\User\User; @@ -588,6 +589,8 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); + RequestContext::getMain()->getOutput()->enableOOUI(); + $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); // $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); $nsfwMessage = new IconWidget( [ 'icon' => 'check' ] ) . 'Yes'; From d65e25bb66ff165b51dfacb1811135cf379ddaaa Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:20:11 -0600 Subject: [PATCH 062/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 24b6a721d..ed6f71016 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -604,7 +604,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'type' => 'info', 'section' => 'details', 'raw' => true, - 'default' => $nsfwMessage->parse(), + 'default' => $nsfwMessage, ] ); From 7ea7e6c3b13f6ad2e4db6844002a042e0f8b843c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:23:49 -0600 Subject: [PATCH 063/162] Try --- includes/HookHandlers/RequestWiki.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ed6f71016..939c2f82c 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -592,8 +592,10 @@ public function onRequestWikiQueueFormDescriptorModify( RequestContext::getMain()->getOutput()->enableOOUI(); $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); - // $nsfwMessage = new RawMessage( $isNsfw ? '{{Done|Yes}}' : '{{Notdone|No}}' ); - $nsfwMessage = new IconWidget( [ 'icon' => 'check' ] ) . 'Yes'; + $nsfwMessage = new RawMessage( $isNsfw ? + new IconWidget( [ 'icon' => 'check' ] ) . "'''Yes'''" : + new IconWidget( [ 'icon' => 'close' ] ) . "''No'''" + ); RequestWikiFormUtils::insertFieldAfter( $formDescriptor, @@ -604,7 +606,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'type' => 'info', 'section' => 'details', 'raw' => true, - 'default' => $nsfwMessage, + 'default' => $nsfwMessage->parse(), ] ); From 0e796de490d6efad623f05bb0ac1cc63e756adf8 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:25:19 -0600 Subject: [PATCH 064/162] fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 939c2f82c..3d86bfa77 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check' ] ) . "'''Yes'''" : - new IconWidget( [ 'icon' => 'close' ] ) . "''No'''" + new IconWidget( [ 'icon' => 'close' ] ) . "'''No'''" ); RequestWikiFormUtils::insertFieldAfter( From e51fe457bcafceed53375e200fc90609023ee306 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:29:15 -0600 Subject: [PATCH 065/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 3d86bfa77..c15a85a89 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -593,7 +593,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? - new IconWidget( [ 'icon' => 'check' ] ) . "'''Yes'''" : + new IconWidget( [ 'icon' => 'check', 'label' => 'Yes' ] ) . "'''Yes'''" : new IconWidget( [ 'icon' => 'close' ] ) . "'''No'''" ); From d62a0453e4749d13f92574b03f8b11ccb8ee1bb2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:30:48 -0600 Subject: [PATCH 066/162] Fix --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c15a85a89..e84d92253 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -593,8 +593,8 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? - new IconWidget( [ 'icon' => 'check', 'label' => 'Yes' ] ) . "'''Yes'''" : - new IconWidget( [ 'icon' => 'close' ] ) . "'''No'''" + new IconWidget( [ 'icon' => 'check' ] ) . " '''Yes'''" : + new IconWidget( [ 'icon' => 'close' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 6ff3b6c7b0ad085fbe4778d84bd2c68b1ed5a985 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:33:48 -0600 Subject: [PATCH 067/162] flags --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index e84d92253..8c85074c7 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -593,8 +593,8 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? - new IconWidget( [ 'icon' => 'check' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : + new IconWidget( [ 'icon' => 'close', 'flags' => 'destructive' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From a12c1925c7d92b576ac3d185b4db09ef2b238741 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:35:03 -0600 Subject: [PATCH 068/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8c85074c7..f7fcfb9de 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'flags' => 'destructive' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'flags' => 'error' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From a26f6a28a2a0ff3117b205a9d0f6ff7ed2ffbba4 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:37:20 -0600 Subject: [PATCH 069/162] destructive --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index f7fcfb9de..8c85074c7 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'flags' => 'error' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'flags' => 'destructive' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From a49f2281aae751a43b83348a742efb7cea24ca96 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:40:14 -0600 Subject: [PATCH 070/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8c85074c7..c50b7d523 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'flags' => 'destructive' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'flags' => [ 'destructive' ] ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From da897e40d320362fbfc8e4233c9058f263ea284d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:44:51 -0600 Subject: [PATCH 071/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c50b7d523..a5f7c6b2d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'flags' => [ 'destructive' ] ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'framed' => false, 'flags' => [ 'destructive' ] ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 13fde8c8e8635b361a782e87ee9bbcc7a090836d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:45:34 -0600 Subject: [PATCH 072/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index a5f7c6b2d..ababc64a0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'framed' => false, 'flags' => [ 'destructive' ] ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'clear', 'framed' => false, 'flags' => [ 'destructive' ] ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 764af8f851aca3ce389f0ff8922feb95d33351b8 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:46:33 -0600 Subject: [PATCH 073/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ababc64a0..3572e5807 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'clear', 'framed' => false, 'flags' => [ 'destructive' ] ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'cancel', 'framed' => false, 'flags' => [ 'destructive' ] ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From cc1e2ce6e153808503afca55b1dc53ad4a82fe5b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:47:29 -0600 Subject: [PATCH 074/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 3572e5807..3c5c72336 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'cancel', 'framed' => false, 'flags' => [ 'destructive' ] ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close-destructive' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 98c5fd2588f91bbd5539f9112420623885329f18 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:53:53 -0600 Subject: [PATCH 075/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 3c5c72336..1bfb7fc7c 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close-destructive' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'alert', 'flags' => 'destructive' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 4e49824a2e5687ea275da597fbc10897ed12bb02 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 15:55:27 -0600 Subject: [PATCH 076/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 1bfb7fc7c..4d192a2ef 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'alert', 'flags' => 'destructive' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'alert', 'flags' => [ 'destructive' ] ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From d26b49ddea52978f766558a53228491c336ca39d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 16:02:09 -0600 Subject: [PATCH 077/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 4d192a2ef..a678fead5 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'alert', 'flags' => [ 'destructive' ] ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'classes' => [ 'oo-ui-flaggedElement-error' ] ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From d7cb073841c73a4e3ed99ea3e55cc7f4226777a2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 16:10:45 -0600 Subject: [PATCH 078/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index a678fead5..cfd229ef8 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'classes' => [ 'oo-ui-flaggedElement-error' ] ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'cancel', 'flags' => 'destructive' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From a10f6ae7194ca97368ab58187b94bc8374941502 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 16:18:42 -0600 Subject: [PATCH 079/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index cfd229ef8..7e69a3656 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'cancel', 'flags' => 'destructive' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'cancel', 'style' => 'color: #d73333;' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 37d9f57be4e7e561f2167f8ae09ea9a64377c230 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 16:19:20 -0600 Subject: [PATCH 080/162] try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7e69a3656..70ddc6756 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'cancel', 'style' => 'color: #d73333;' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'style' => 'color: #d73333;' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 6250b3b7c1b1906fbdf38d6b6e7e0acbae071c8b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 16:20:10 -0600 Subject: [PATCH 081/162] try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 70ddc6756..3cd729397 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -594,7 +594,7 @@ public function onRequestWikiQueueFormDescriptorModify( $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'style' => 'color: #d73333;' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'close', 'flags' => 'progressive' ] ) . " '''No'''" ); RequestWikiFormUtils::insertFieldAfter( From 9fcdc1984de3b2caf6ce50683a6945d5cdcd1277 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 16:24:03 -0600 Subject: [PATCH 082/162] msg --- includes/HookHandlers/RequestWiki.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 3cd729397..61630c814 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -591,10 +591,13 @@ public function onRequestWikiQueueFormDescriptorModify( RequestContext::getMain()->getOutput()->enableOOUI(); + $yes = wfMessage( 'htmlform-yes' )->escaped(); + $no = wfMessage( 'htmlform-no' )->escaped(); + $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); $nsfwMessage = new RawMessage( $isNsfw ? - new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''Yes'''" : - new IconWidget( [ 'icon' => 'close', 'flags' => 'progressive' ] ) . " '''No'''" + new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''{$yes}'''" : + new IconWidget( [ 'icon' => 'close', 'flags' => 'progressive' ] ) . " '''{$no}'''" ); RequestWikiFormUtils::insertFieldAfter( From 1105188e0cc7ebb67c52f7a8b20802422fc236a7 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 20:13:13 -0600 Subject: [PATCH 083/162] Cleanup --- includes/HookHandlers/RequestWiki.php | 36 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 61630c814..7cb4372e9 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,9 +4,9 @@ use MediaWiki\Config\Config; use MediaWiki\Config\ServiceOptions; +use MediaWiki\Context\IContextSource; use MediaWiki\Context\RequestContext; use MediaWiki\HTMLForm\Field\HTMLToggleSwitchField; -use MediaWiki\Language\RawMessage; use MediaWiki\User\User; use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraDataHook; use Miraheze\CreateWiki\Hooks\RequestWikiFormDescriptorModifyHook; @@ -23,14 +23,17 @@ class RequestWiki implements RequestWikiQueueFormDescriptorModifyHook { + private IContextSource $context; private ServiceOptions $options; - public function __construct( ServiceOptions $options ) { + public function __construct( IContextSource $context, ServiceOptions $options ) { + $this->context = $context; $this->options = $options; } public static function factory( Config $mainConfig ): self { return new self( + RequestContext::getMain(), new ServiceOptions( [ 'ManageWikiExtensions', @@ -589,16 +592,10 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - RequestContext::getMain()->getOutput()->enableOOUI(); - - $yes = wfMessage( 'htmlform-yes' )->escaped(); - $no = wfMessage( 'htmlform-no' )->escaped(); + // We need to make sure we have OOUI enabled for IconWidget + $this->context->getOutput()->enableOOUI(); $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); - $nsfwMessage = new RawMessage( $isNsfw ? - new IconWidget( [ 'icon' => 'check', 'flags' => 'success' ] ) . " '''{$yes}'''" : - new IconWidget( [ 'icon' => 'close', 'flags' => 'progressive' ] ) . " '''{$no}'''" - ); RequestWikiFormUtils::insertFieldAfter( $formDescriptor, @@ -609,12 +606,11 @@ public function onRequestWikiQueueFormDescriptorModify( 'type' => 'info', 'section' => 'details', 'raw' => true, - 'default' => $nsfwMessage->parse(), + 'default' => $this->getDetailsWithIcon( $isNsfw ), ] ); $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); - $sourceMessage = new RawMessage( $hasSource ? '{{Done|Yes}}' : '{{Notdone|No}}' ); RequestWikiFormUtils::insertFieldAfter( $formDescriptor, @@ -625,7 +621,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'type' => 'info', 'section' => 'details', 'raw' => true, - 'default' => $sourceMessage->parse(), + 'default' => $this->getDetailsWithIcon( $hasSource ), ] ); } @@ -673,4 +669,18 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwExtensions->commit(); } } + + private function getIconWidget( bool $fieldcheck ): string { + if ( $fieldCheck ) { + return new IconWidget( [ + 'icon' => 'check', + 'flags' => 'success', + ] ) . ' ' . $this->context->msg( 'htmlform-yes' )->escaped(); + } + + return new IconWidget( [ + 'icon' => 'close', + 'flags' => 'progressive', + ] ) . ' ' . $this->context->msg( 'htmlform-no' )->escaped(); + } } From 7b59e3ebeb174bb726d2eb9eaaee0a3197618d99 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 20:15:14 -0600 Subject: [PATCH 084/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7cb4372e9..ef40da093 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -670,7 +670,7 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string } } - private function getIconWidget( bool $fieldcheck ): string { + private function getDetailsWithIcon( bool $fieldCheck ): string { if ( $fieldCheck ) { return new IconWidget( [ 'icon' => 'check', From f9834c7e3148b130b9f827f65d87c9b9da8cba1c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 20:16:08 -0600 Subject: [PATCH 085/162] Fix --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ef40da093..05b8d4fe0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -595,7 +595,7 @@ public function onRequestWikiQueueFormDescriptorModify( // We need to make sure we have OOUI enabled for IconWidget $this->context->getOutput()->enableOOUI(); - $isNsfw = $wikiRequestManager->getExtraFieldData( 'nsfw' ); + $isNsfw = (bool)$wikiRequestManager->getExtraFieldData( 'nsfw' ); RequestWikiFormUtils::insertFieldAfter( $formDescriptor, @@ -610,7 +610,7 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - $hasSource = $wikiRequestManager->getExtraFieldData( 'source' ); + $hasSource = (bool)$wikiRequestManager->getExtraFieldData( 'source' ); RequestWikiFormUtils::insertFieldAfter( $formDescriptor, From 890cb7bb39ed66a90cb8d0f19a0cda5bd9d4d740 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 20:21:27 -0600 Subject: [PATCH 086/162] Try --- includes/HookHandlers/RequestWiki.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 05b8d4fe0..614bfcf05 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -16,6 +16,7 @@ use Miraheze\ManageWiki\Helpers\ManageWikiExtensions; use Miraheze\ManageWiki\Helpers\ManageWikiSettings; use OOUI\IconWidget; +use OOUI\Tag; class RequestWiki implements CreateWikiAfterCreationWithExtraDataHook, @@ -675,12 +676,18 @@ private function getDetailsWithIcon( bool $fieldCheck ): string { return new IconWidget( [ 'icon' => 'check', 'flags' => 'success', - ] ) . ' ' . $this->context->msg( 'htmlform-yes' )->escaped(); + ] ) . ' ' . + ( new Tag( 'b' ) )->appendContent( + $this->context->msg( 'htmlform-yes' )->escaped() + ); } return new IconWidget( [ 'icon' => 'close', 'flags' => 'progressive', - ] ) . ' ' . $this->context->msg( 'htmlform-no' )->escaped(); + ] ) . ' ' . + ( new Tag( 'b' ) )->appendContent( + $this->context->msg( 'htmlform-yes' )->escaped() + ); } } From f55034b8ffd7951298cdf886d0c42d8f0b8f5917 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 14 Oct 2024 20:22:09 -0600 Subject: [PATCH 087/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 614bfcf05..ba1e73777 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -687,7 +687,7 @@ private function getDetailsWithIcon( bool $fieldCheck ): string { 'flags' => 'progressive', ] ) . ' ' . ( new Tag( 'b' ) )->appendContent( - $this->context->msg( 'htmlform-yes' )->escaped() + $this->context->msg( 'htmlform-no' )->escaped() ); } } From 1d10bc5ed87ec0124fcbcacd9d60ff25d2148b39 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 11:27:40 -0600 Subject: [PATCH 088/162] Add --- i18n/miraheze/en.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/i18n/miraheze/en.json b/i18n/miraheze/en.json index f6b8fbfbe..88cb2e69d 100644 --- a/i18n/miraheze/en.json +++ b/i18n/miraheze/en.json @@ -198,11 +198,20 @@ "protect-level-user": "Allow only logged in users", "requestimport-text": "Welcome to RequestImport! To get started with your import, please fill out this form so we can review your request. Your wiki request will be reviewed by a Technology team member or Steward, and it can be tracked at the page that will be given when submitting your request.\n\nIf your upload here times out or fails, please create a task on [[Phorge]].\n\nIf you wish to import images as well, please also create a task on [[Phorge]].", "requestssl-text": "Welcome to RequestSSL! Please read [[Custom domains]] and make sure your domain is pointed correctly before requesting an SSL certificate here and that your wiki is created. Your custom domain request will be reviewed by a Technology team member, and it can be tracked at the page that will be given when submitting your request.\n\nIf you want to use your own SSL certificate provider instead of Let's Encrypt, please create a task on [[Phorge]].\n\nIf there is an error, or if you would like to request a redirect, please create a task on [[Phorge]].", + "requestwiki-label-defaultextensions": "Extensions and skins that should be enabled on your wiki by default:", + "requestwiki-help-defaultextensions": "You will always be able to enable or disable these later with Special:ManageWiki/extensions on your wiki after it has been created.", + "requestwiki-label-defaultskin": "What would you like the default skin of your wiki to be?", "requestwiki-label-nsfw": "This wiki includes content that is not safe for work (NSFW)", "requestwiki-help-nsfw": "A wiki is not safe for work (NSFW) if it includes graphic discussion of sex (either text or media content) or is otherwise inappropriate for those under the age of 18.", "requestwiki-label-nsfwtext": "Please give us more details about the type of NSFW content that your wiki will contain", "requestwiki-label-source": "This wiki is moving or forking from an existing wiki", "requestwiki-label-sourceurl": "Enter the full URL of the source wiki (the wiki you are moving or forking from)", + "requestwiki-label-showadvanced": "Show advanced options?", + "requestwiki-advanced": "Advanced configuration", + "requestwiki-configure": "Wiki configuration", + "requestiki-confirmation": "Confirmation", + "requestwiki-core": "Core settings", + "requestwiki-info": "Request information", "restriction-delete": "Delete", "restriction-level-user": "Allow only logged in users", "right-user": "Edit pages protected as \"{{int:protect-level-user}}\"", From 2b94165f6bb7512406d7897b09a94f6fef3f4429 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 11:31:02 -0600 Subject: [PATCH 089/162] Fix --- i18n/miraheze/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/miraheze/en.json b/i18n/miraheze/en.json index 88cb2e69d..2d9105e09 100644 --- a/i18n/miraheze/en.json +++ b/i18n/miraheze/en.json @@ -209,7 +209,7 @@ "requestwiki-label-showadvanced": "Show advanced options?", "requestwiki-advanced": "Advanced configuration", "requestwiki-configure": "Wiki configuration", - "requestiki-confirmation": "Confirmation", + "requestwiki-confirmation": "Confirmation", "requestwiki-core": "Core settings", "requestwiki-info": "Request information", "restriction-delete": "Delete", From a0877c2379b8f2af136f42a08e3ea1853fa91fa4 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:13:01 -0600 Subject: [PATCH 090/162] Remove --- includes/HookHandlers/RequestWiki.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ba1e73777..c6bd8c8e9 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -250,24 +250,12 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'confirmation' ); - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'category', - newProperties: [ 'help-inline' => false ] - ); - RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'subdomain', newProperties: [ 'help-inline' => false ] ); - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'sitename', - newProperties: [ 'help-inline' => false ] - ); - RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'private', From 5fa06ee1b77740755caaa311cec0f73746f39acf Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:37:03 -0600 Subject: [PATCH 091/162] Update --- includes/HookHandlers/RequestWiki.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c6bd8c8e9..29666d541 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -250,6 +250,20 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newSection: 'confirmation' ); + // We use a more descriptive label message for + // category, so we don't need the help message. + RequestWikiFormUtils::unsetFieldProperty( + $formDescriptor, + fieldKey: 'category', + propertyKey: 'help-message' + ); + + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'category', + newProperties: [ 'label-message' => 'requestwiki-label-category' ] + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'subdomain', From e403cdff10bfe29a8a87497f0bc52ee4441f48db Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:39:06 -0600 Subject: [PATCH 092/162] - --- i18n/overrides/en.json | 1 - 1 file changed, 1 deletion(-) diff --git a/i18n/overrides/en.json b/i18n/overrides/en.json index b5623296f..b9b58d82f 100644 --- a/i18n/overrides/en.json +++ b/i18n/overrides/en.json @@ -18,7 +18,6 @@ "miraheze-createwiki-email-subject": "Your new Miraheze wiki ($1) has been created", "miraheze-createwiki-error-subdomaintaken": "The subdomain you requested is already taken. There might already be a wiki covering your topic; if that's the case, contribute to that wiki instead (wikis on the same topic are prohibited and deleted upon detection). Select another subdomain and try again.", "miraheze-createwiki-help-bio": "Content regarding real people is expected to make an effort to limit bias/present a neutral point of view. You must not share personal information without explicit consent. See [[Disclosure of Personal Data on Wikis]]", - "miraheze-createwiki-help-category": "The category helps sorting the wiki on places such as [[Special:WikiDiscover]]. Visit ManageWiki after creation to write a brief description too!", "miraheze-createwiki-help-reason": "Feel free to expand the box for easier editing! Unfortunately there is no fancy formatting like bold, clickable links etc here.", "miraheze-createwiki-help-subdomain": "This will be the wiki's URL. Please make sure it is unique to your wiki and not too generic. Your database name will be this with 'wiki' at the end, ie, yoursubdomain -> yoursubdomainwiki. This can be changed later.", "miraheze-createwiki-label-reason": "You will need to inform us the ''topic'' of your wiki (what is it about?), the ''scope'' of your wiki (what does it include?), and anything else you believe will help. This can include:\n* A link to a public existing community for the wiki if it is a migration, or a link to the content the wiki will be covering.\n* What controversial content may be covered by the wiki, and how you will moderate it to ensure it complies with global policy.\n* If the wiki will cover \"NSFW\" content. There is a section in the Content Policy regarding this.\n* If the wiki is personal (your work, vs documenting something else), made on behalf of an organization, or if it is on behalf of a non-wiki community, like a Discord Server.\n* Share some details if you like! If it's about a game franchise, a specific region, your worldbuilding...\n\nWith this information we will be able to determine if the content is likely to be compatible with Miraheze. More detail is better, as long as it is clear and relevant. This ranges from two sentences to a couple short paragraphs. Structure it how you like.\n\n'''Please do not use ChatGPT or any other AI model:''' They are rarely clear or relevant enough, and increases the chance you will be asked to rephrase or explain in specific.\n\n----\n\nNow, please tell us the topic & scope of your wiki in at least two sentences...", From 350bbd0d4db63c4ae178a71ac9e0a8b512334468 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:40:09 -0600 Subject: [PATCH 093/162] Add --- i18n/miraheze/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/i18n/miraheze/en.json b/i18n/miraheze/en.json index 2d9105e09..4e5e87256 100644 --- a/i18n/miraheze/en.json +++ b/i18n/miraheze/en.json @@ -200,6 +200,7 @@ "requestssl-text": "Welcome to RequestSSL! Please read [[Custom domains]] and make sure your domain is pointed correctly before requesting an SSL certificate here and that your wiki is created. Your custom domain request will be reviewed by a Technology team member, and it can be tracked at the page that will be given when submitting your request.\n\nIf you want to use your own SSL certificate provider instead of Let's Encrypt, please create a task on [[Phorge]].\n\nIf there is an error, or if you would like to request a redirect, please create a task on [[Phorge]].", "requestwiki-label-defaultextensions": "Extensions and skins that should be enabled on your wiki by default:", "requestwiki-help-defaultextensions": "You will always be able to enable or disable these later with Special:ManageWiki/extensions on your wiki after it has been created.", + "requestwiki-label-category": "How would you like your wiki to be categorized in the [[Special:WikiDiscover|global directory]]?", "requestwiki-label-defaultskin": "What would you like the default skin of your wiki to be?", "requestwiki-label-nsfw": "This wiki includes content that is not safe for work (NSFW)", "requestwiki-help-nsfw": "A wiki is not safe for work (NSFW) if it includes graphic discussion of sex (either text or media content) or is otherwise inappropriate for those under the age of 18.", From 680fd65bcfa6430268f47cc122cdd552487672ff Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:48:24 -0600 Subject: [PATCH 094/162] Add --- i18n/miraheze/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i18n/miraheze/en.json b/i18n/miraheze/en.json index 4e5e87256..2ed5a9951 100644 --- a/i18n/miraheze/en.json +++ b/i18n/miraheze/en.json @@ -208,6 +208,8 @@ "requestwiki-label-source": "This wiki is moving or forking from an existing wiki", "requestwiki-label-sourceurl": "Enter the full URL of the source wiki (the wiki you are moving or forking from)", "requestwiki-label-showadvanced": "Show advanced options?", + "requestwiki-label-wddescription": "Enter a short description of your wiki that will appear publicly in the [[Special:WikiDiscover|global directory]]:", + "requestwiki-help-wddescription": "You can change this in Special:ManageWiki after your wiki has been created.", "requestwiki-advanced": "Advanced configuration", "requestwiki-configure": "Wiki configuration", "requestwiki-confirmation": "Confirmation", From 886e564c4e85f6b1a075c9e76fe6e3a56d51d98e Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:48:56 -0600 Subject: [PATCH 095/162] Update --- includes/HookHandlers/RequestWiki.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 29666d541..97c9c86bd 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -119,7 +119,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'type' => 'text', 'maxlength' => 512, - 'label-message' => 'managewiki-label-description', + 'label-message' => 'requestwiki-label-wddescription', + 'help-message' => 'requestwiki-help-wddescription', 'cssclass' => 'createwiki-infuse', 'section' => 'configure', ] @@ -418,7 +419,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'text', 'maxlength' => 512, - 'label-message' => 'managewiki-label-description', + 'label-message' => 'requestwiki-label-wddescription', 'section' => 'editing/configure', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'wddescription' ), From 3ec755260d3952935919b5a808f8e0b23b5d44a1 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 12:59:54 -0600 Subject: [PATCH 096/162] Update message --- i18n/overrides/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/overrides/en.json b/i18n/overrides/en.json index b9b58d82f..24d44f00a 100644 --- a/i18n/overrides/en.json +++ b/i18n/overrides/en.json @@ -58,7 +58,7 @@ "miraheze-prefs-help-realname": "Real name is optional. If you choose to provide it, this will be used for giving you attribution for your work. Also, by using a wiki hosted by Miraheze, you agree to the [https://meta.miraheze.org/wiki/Special:MyLanguage/Terms_of_Use Terms of Use] and accept the [https://meta.miraheze.org/wiki/Special:MyLanguage/Privacy_Policy Privacy Policy].", "miraheze-privacypage": "m:Special:MyLanguage/Privacy Policy", "miraheze-requestwiki-error-invalidcomment": "Your wiki request contains an invalid character. Correct that and try again. If you need help, [[Help center|contact us]].", - "miraheze-requestwiki-info-guidance": "Just a couple sections left! This one is very important.", + "miraheze-requestwiki-info-guidance": "This section is crucial in determining if your wiki request meets the criteria for approval by Wiki Creators. Please ensure you provide detailed and specific answers to each question. Using AI-generated descriptions can be easily recognized and may lower your chances of approval. Provide sufficient detail without being overly excessive. This will assist Wiki Creators in processing your request efficiently, increasing both the chances and speed of approval. Thank you!", "miraheze-requestwiki-info-guidance-post": "You're just about done. Please review to ensure you've completed all sections and provided all relevant details. When you've done so, we'll get back to you as soon as we can. Feel free to look around Meta, meet your fellow wiki operators in the meantime. We like seeing new faces here.", "miraheze-requestwiki-label-agreement": "'''I have read and accept [[Special:MyLanguage/Content Policy|Content Policy]], [[Special:MyLanguage/Dormancy Policy|Dormancy Policy]], [[Special:MyLanguage/Wiki Governance policy|Wiki Governance Policy]] and [[Special:MyLanguage/Global Conduct Policy|Global Conduct Policy]]''', and by requesting a wiki, I agree to all our [[Special:MyLanguage/Global policies|global policies]].", "miraheze-requestwiki-success": "Your wiki request ($1) was successfully submitted. Your request will be reviewed by a volunteer wiki creator as soon as possible.", From 39c1814f56547fe1f7b48a218b43cb80519a683d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:04:24 -0600 Subject: [PATCH 097/162] - --- includes/HookHandlers/Main.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/HookHandlers/Main.php b/includes/HookHandlers/Main.php index 624cb4cb7..dfc588430 100644 --- a/includes/HookHandlers/Main.php +++ b/includes/HookHandlers/Main.php @@ -490,7 +490,6 @@ public function onMessageCacheFetchOverrides( array &$keys ): void { 'createwiki-email-subject', 'createwiki-error-subdomaintaken', 'createwiki-help-bio', - 'createwiki-help-category', 'createwiki-help-reason', 'createwiki-help-subdomain', 'createwiki-label-reason', From 7af6ae47ef65af6b60443b9f41079138f43e0cce Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:05:53 -0600 Subject: [PATCH 098/162] - --- i18n/overrides/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/overrides/en.json b/i18n/overrides/en.json index 24d44f00a..550eaee4c 100644 --- a/i18n/overrides/en.json +++ b/i18n/overrides/en.json @@ -58,7 +58,7 @@ "miraheze-prefs-help-realname": "Real name is optional. If you choose to provide it, this will be used for giving you attribution for your work. Also, by using a wiki hosted by Miraheze, you agree to the [https://meta.miraheze.org/wiki/Special:MyLanguage/Terms_of_Use Terms of Use] and accept the [https://meta.miraheze.org/wiki/Special:MyLanguage/Privacy_Policy Privacy Policy].", "miraheze-privacypage": "m:Special:MyLanguage/Privacy Policy", "miraheze-requestwiki-error-invalidcomment": "Your wiki request contains an invalid character. Correct that and try again. If you need help, [[Help center|contact us]].", - "miraheze-requestwiki-info-guidance": "This section is crucial in determining if your wiki request meets the criteria for approval by Wiki Creators. Please ensure you provide detailed and specific answers to each question. Using AI-generated descriptions can be easily recognized and may lower your chances of approval. Provide sufficient detail without being overly excessive. This will assist Wiki Creators in processing your request efficiently, increasing both the chances and speed of approval. Thank you!", + "miraheze-requestwiki-info-guidance": "This section is crucial in determining if your wiki request meets the criteria for approval by Wiki Creators. Provide sufficient detail without being overly excessive. This will assist Wiki Creators in processing your request efficiently, increasing both the chances and speed of approval. Thank you!", "miraheze-requestwiki-info-guidance-post": "You're just about done. Please review to ensure you've completed all sections and provided all relevant details. When you've done so, we'll get back to you as soon as we can. Feel free to look around Meta, meet your fellow wiki operators in the meantime. We like seeing new faces here.", "miraheze-requestwiki-label-agreement": "'''I have read and accept [[Special:MyLanguage/Content Policy|Content Policy]], [[Special:MyLanguage/Dormancy Policy|Dormancy Policy]], [[Special:MyLanguage/Wiki Governance policy|Wiki Governance Policy]] and [[Special:MyLanguage/Global Conduct Policy|Global Conduct Policy]]''', and by requesting a wiki, I agree to all our [[Special:MyLanguage/Global policies|global policies]].", "miraheze-requestwiki-success": "Your wiki request ($1) was successfully submitted. Your request will be reviewed by a volunteer wiki creator as soon as possible.", From 19ada1545f90de3a5e9c6abafd8ef22b35d722a0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:24:47 -0600 Subject: [PATCH 099/162] Try --- includes/HookHandlers/RequestWiki.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 97c9c86bd..ff666814f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -265,6 +265,12 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newProperties: [ 'label-message' => 'requestwiki-label-category' ] ); + RequestWikiFormUtils::updateFieldProperties( + $formDescriptor, + fieldKey: 'reason', + newProperties: [ 'useeditfont' => true ] + ); + RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'subdomain', From aeb4efe3d4679f9ecac1eeb42435abcb59e0717b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:42:07 -0600 Subject: [PATCH 100/162] try --- includes/HookHandlers/RequestWiki.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ff666814f..be5d37c2f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -16,6 +16,7 @@ use Miraheze\ManageWiki\Helpers\ManageWikiExtensions; use Miraheze\ManageWiki\Helpers\ManageWikiSettings; use OOUI\IconWidget; +use OOUI\MessageWidget; use OOUI\Tag; class RequestWiki implements @@ -137,6 +138,17 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'warn', + newField: [ + 'type' => 'info', + 'default' => $this->getMessageNotice(), + 'raw' => true, + 'section' => 'advanced', + ] + ); + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'mainpageroot', @@ -680,6 +692,10 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string } } + private function getMessageNotice(): string { + return ( new MessageWidget( [ 'label' => 'test' ] ) )->toString(); + } + private function getDetailsWithIcon( bool $fieldCheck ): string { if ( $fieldCheck ) { return new IconWidget( [ From acac92bbb1690fb5fcddb03112d95a18062f202c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:43:07 -0600 Subject: [PATCH 101/162] Add --- includes/HookHandlers/RequestWiki.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index be5d37c2f..79ba76e2b 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -48,6 +48,9 @@ public static function factory( Config $mainConfig ): self { } public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { + // We need to make sure we have OOUI enabled for MessageWidget + $this->context->getOutput()->enableOOUI(); + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', From 049b9339727881538728de704ec1cc1fc1d176cb Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:45:39 -0600 Subject: [PATCH 102/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 79ba76e2b..60207fe7c 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -696,7 +696,7 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string } private function getMessageNotice(): string { - return ( new MessageWidget( [ 'label' => 'test' ] ) )->toString(); + return ( new MessageWidget( [ 'label' => 'test', 'type' => 'warning', 'inline' => true ] ) )->toString(); } private function getDetailsWithIcon( bool $fieldCheck ): string { From 4f83ce96f75c04e41e2092e6dd0a182e69a398d5 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:47:29 -0600 Subject: [PATCH 103/162] Add test --- includes/HookHandlers/RequestWiki.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 60207fe7c..665a55e70 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -345,6 +345,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi section: 'advanced', newOrder: [ 'showadvanced', + 'warn', 'mainpageroot', 'articlepath', 'defaultextensions', @@ -696,7 +697,7 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string } private function getMessageNotice(): string { - return ( new MessageWidget( [ 'label' => 'test', 'type' => 'warning', 'inline' => true ] ) )->toString(); + return ( new MessageWidget( [ 'label' => 'WARNING: THESE ARE ADVANCED SETTINGS', 'type' => 'warning', 'inline' => true ] ) )->toString(); } private function getDetailsWithIcon( bool $fieldCheck ): string { From 4ecd1ddd9d97570dcff03d3bdf69141c6001f585 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 13:53:51 -0600 Subject: [PATCH 104/162] Remove --- includes/HookHandlers/RequestWiki.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 665a55e70..ff666814f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -16,7 +16,6 @@ use Miraheze\ManageWiki\Helpers\ManageWikiExtensions; use Miraheze\ManageWiki\Helpers\ManageWikiSettings; use OOUI\IconWidget; -use OOUI\MessageWidget; use OOUI\Tag; class RequestWiki implements @@ -48,9 +47,6 @@ public static function factory( Config $mainConfig ): self { } public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { - // We need to make sure we have OOUI enabled for MessageWidget - $this->context->getOutput()->enableOOUI(); - RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', @@ -141,17 +137,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::addFieldToEnd( - $formDescriptor, - newKey: 'warn', - newField: [ - 'type' => 'info', - 'default' => $this->getMessageNotice(), - 'raw' => true, - 'section' => 'advanced', - ] - ); - RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'mainpageroot', @@ -345,7 +330,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi section: 'advanced', newOrder: [ 'showadvanced', - 'warn', 'mainpageroot', 'articlepath', 'defaultextensions', @@ -696,10 +680,6 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string } } - private function getMessageNotice(): string { - return ( new MessageWidget( [ 'label' => 'WARNING: THESE ARE ADVANCED SETTINGS', 'type' => 'warning', 'inline' => true ] ) )->toString(); - } - private function getDetailsWithIcon( bool $fieldCheck ): string { if ( $fieldCheck ) { return new IconWidget( [ From fa5345098a080b5a18f67b06f382fdde62a306b3 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 14:54:12 -0600 Subject: [PATCH 105/162] Test --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ff666814f..e066187f4 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -351,6 +351,7 @@ public function onRequestWikiQueueFormDescriptorModify( User $user, WikiRequestManager $wikiRequestManager ): void { + var_dump( $wikiRequestManager->getAllExtraData() ); RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'edit-nsfw', From f66c4dc1a92d7ca3b397cc11c1666fa8c5ce160f Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:03:52 -0600 Subject: [PATCH 106/162] - --- includes/HookHandlers/RequestWiki.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index e066187f4..ff666814f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -351,7 +351,6 @@ public function onRequestWikiQueueFormDescriptorModify( User $user, WikiRequestManager $wikiRequestManager ): void { - var_dump( $wikiRequestManager->getAllExtraData() ); RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'edit-nsfw', From 0bf78d1220a9dbfe1e0cb23c29c0378c5a3092c1 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:17:36 -0600 Subject: [PATCH 107/162] Try disable-if --- includes/HookHandlers/RequestWiki.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ff666814f..f418e2e2b 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -441,6 +441,16 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', 'default' => $wikiRequestManager->getExtraFieldData( 'showadvanced' ), + 'disable-if' => [ + 'AND', + [ '===', 'edit-showadvanced', '1' ], + [ + 'OR', + [ '!==', 'edit-mainpageroot', false ], + [ '!==', 'edit-articlepath', '/wiki/$1' ], + [ '!==', 'edit-defaultextensions', [] ], + ] + ], ] ); From afb1169302339b00a4873783f644b7ec97fd370b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:18:56 -0600 Subject: [PATCH 108/162] Try --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index f418e2e2b..897c8cd89 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -446,9 +446,9 @@ public function onRequestWikiQueueFormDescriptorModify( [ '===', 'edit-showadvanced', '1' ], [ 'OR', - [ '!==', 'edit-mainpageroot', false ], + [ '!==', 'edit-mainpageroot', '0' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ '!==', 'edit-defaultextensions', [] ], + [ '!==', 'edit-defaultextensions', '[]' ], ] ], ] From 5d6aeac42c05b22cdd27a4dfd9e94ef1491b03e1 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:19:43 -0600 Subject: [PATCH 109/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 897c8cd89..eee1eb180 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,7 +448,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '!==', 'edit-mainpageroot', '0' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ '!==', 'edit-defaultextensions', '[]' ], + [ '!==', 'edit-defaultextensions', [] ], ] ], ] From c3f22273ed671df357e8b25317450d061b380f16 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:20:37 -0600 Subject: [PATCH 110/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index eee1eb180..944cb08f8 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,7 +448,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '!==', 'edit-mainpageroot', '0' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ '!==', 'edit-defaultextensions', [] ], + [ '!==', 'edit-defaultextensions', '' ], ] ], ] From 4fd67bb742254fb94d99fbcdddd142dd69dda114 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:26:41 -0600 Subject: [PATCH 111/162] Try --- includes/HookHandlers/RequestWiki.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 944cb08f8..bf70d5be7 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,7 +448,6 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '!==', 'edit-mainpageroot', '0' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ '!==', 'edit-defaultextensions', '' ], ] ], ] From 118ca985fbb085a9dbf5b2f0028f869bc9ffbe6d Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:28:46 -0600 Subject: [PATCH 112/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index bf70d5be7..c7a3a0181 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -446,7 +446,7 @@ public function onRequestWikiQueueFormDescriptorModify( [ '===', 'edit-showadvanced', '1' ], [ 'OR', - [ '!==', 'edit-mainpageroot', '0' ], + [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], ] ], From 85bef65540f6186c0ca7d6b5fbaf20f7bf7c5e48 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:29:26 -0600 Subject: [PATCH 113/162] Try --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c7a3a0181..dc5ab99b9 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,6 +448,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], + [ '!==', 'edit-defaultextensions', '[]' ], ] ], ] From d59ee3f8903af72af0ef712bd943b3df88db91a5 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:30:47 -0600 Subject: [PATCH 114/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index dc5ab99b9..7b9c58326 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,7 +448,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ '!==', 'edit-defaultextensions', '[]' ], + [ '!==', 'edit-defaultextensions', '' ], ] ], ] From 84b5479132be4c72be93a226857f810b3927e86a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:32:44 -0600 Subject: [PATCH 115/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7b9c58326..ed5e7f810 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,7 +448,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ '!==', 'edit-defaultextensions', '' ], + [ '!==', 'edit-defaultextensions', 'null' ], ] ], ] From 1a6a4d6bd61f33c7baddbd11832a94248c6cc78a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:33:49 -0600 Subject: [PATCH 116/162] try --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index ed5e7f810..cf2fde29d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,6 +448,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], + [ 'true' ], [ '!==', 'edit-defaultextensions', 'null' ], ] ], From d8e8680e29ed116b1308134a21cf4f9035fc94a4 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:48:33 -0600 Subject: [PATCH 117/162] Remove --- includes/HookHandlers/RequestWiki.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index cf2fde29d..c7a3a0181 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,8 +448,6 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - [ 'true' ], - [ '!==', 'edit-defaultextensions', 'null' ], ] ], ] From 35d697933b06f5764fd582c1902557dc199ae271 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:50:49 -0600 Subject: [PATCH 118/162] Add disable-if --- includes/HookHandlers/RequestWiki.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c7a3a0181..dafc0e72a 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -134,6 +134,15 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'advanced', + 'disable-if' => [ + 'AND', + [ '===', 'showadvanced', '1' ], + [ + 'OR', + [ '===', 'mainpageroot', '1' ], + [ '!==', 'articlepath', '/wiki/$1' ], + ], + ], ] ); @@ -448,7 +457,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'OR', [ '===', 'edit-mainpageroot', '1' ], [ '!==', 'edit-articlepath', '/wiki/$1' ], - ] + ], ], ] ); From 1e77aef78f84e4ce49af0991dd4afed4a9192f0a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 15:55:19 -0600 Subject: [PATCH 119/162] Fix --- includes/HookHandlers/RequestWiki.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index dafc0e72a..5a00e4bc1 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -134,15 +134,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'advanced', - 'disable-if' => [ - 'AND', - [ '===', 'showadvanced', '1' ], - [ - 'OR', - [ '===', 'mainpageroot', '1' ], - [ '!==', 'articlepath', '/wiki/$1' ], - ], - ], ] ); @@ -449,16 +440,10 @@ public function onRequestWikiQueueFormDescriptorModify( 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', - 'default' => $wikiRequestManager->getExtraFieldData( 'showadvanced' ), - 'disable-if' => [ - 'AND', - [ '===', 'edit-showadvanced', '1' ], - [ - 'OR', - [ '===', 'edit-mainpageroot', '1' ], - [ '!==', 'edit-articlepath', '/wiki/$1' ], - ], - ], + 'default' => + $wikiRequestManager->getExtraFieldData( 'mainpageroot' ) !== false || + $wikiRequestManager->getExtraFieldData( 'articlepath' ) !== '/wiki/$1' || + $wikiRequestManager->getExtraFieldData( 'defaultextensions' ) !== [], ] ); From bbe096186defbaed64822c19fee09b3b623069d8 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:01:24 -0600 Subject: [PATCH 120/162] Don't save showadvanced --- includes/HookHandlers/RequestWiki.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 5a00e4bc1..1024e3bef 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -436,6 +436,8 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, newKey: 'edit-showadvanced', newField: [ + // We handle this manually, we don't want to save this field + 'save' => false, 'class' => HTMLToggleSwitchField::class, 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', From 271a35b4bf4f5e96da59d9e65ef46cc5efdbef94 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:12:11 -0600 Subject: [PATCH 121/162] Add disable-if --- includes/HookHandlers/RequestWiki.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 1024e3bef..5e14eb207 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -446,6 +446,15 @@ public function onRequestWikiQueueFormDescriptorModify( $wikiRequestManager->getExtraFieldData( 'mainpageroot' ) !== false || $wikiRequestManager->getExtraFieldData( 'articlepath' ) !== '/wiki/$1' || $wikiRequestManager->getExtraFieldData( 'defaultextensions' ) !== [], + 'disable-if' => [ + 'AND', + [ '===', 'edit-showadvanced', '1' ], + [ + 'OR', + [ '===', 'edit-mainpageroot', '1' ], + [ '!==', 'edit-articlepath', '/wiki/$1' ], + ], + ], ] ); From 53bab32ad4ed00002e7e3925dcb55c7a39bb7369 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:17:55 -0600 Subject: [PATCH 122/162] Try --- includes/HookHandlers/RequestWiki.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 5e14eb207..fc3a2142f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -432,6 +432,10 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); + $isAdvancedModified = $wikiRequestManager->getExtraFieldData( 'mainpageroot' ) !== false || + $wikiRequestManager->getExtraFieldData( 'articlepath' ) !== '/wiki/$1' || + $wikiRequestManager->getExtraFieldData( 'defaultextensions' ) !== []; + RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'edit-showadvanced', @@ -442,10 +446,8 @@ public function onRequestWikiQueueFormDescriptorModify( 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', - 'default' => - $wikiRequestManager->getExtraFieldData( 'mainpageroot' ) !== false || - $wikiRequestManager->getExtraFieldData( 'articlepath' ) !== '/wiki/$1' || - $wikiRequestManager->getExtraFieldData( 'defaultextensions' ) !== [], + 'default' => $isAdvancedModified, + 'disabled' => $isAdvancedModified, 'disable-if' => [ 'AND', [ '===', 'edit-showadvanced', '1' ], From 53b6b23d15b41608fb4bc0f497281287fa988088 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:20:09 -0600 Subject: [PATCH 123/162] Try --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index fc3a2142f..1de090f49 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -446,6 +446,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', + 'invert' => true, 'default' => $isAdvancedModified, 'disabled' => $isAdvancedModified, 'disable-if' => [ From 8169dfa563633a91c1b916af5405eb003327fdaf Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:22:03 -0600 Subject: [PATCH 124/162] Try --- includes/HookHandlers/RequestWiki.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 1de090f49..e03b40ed0 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -446,9 +446,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', - 'invert' => true, 'default' => $isAdvancedModified, - 'disabled' => $isAdvancedModified, 'disable-if' => [ 'AND', [ '===', 'edit-showadvanced', '1' ], From 6263df10f7579f4b64359b09a005b0941d59e9a5 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:25:45 -0600 Subject: [PATCH 125/162] Test --- includes/HookHandlers/RequestWiki.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index e03b40ed0..c4717f8e5 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -445,8 +445,10 @@ public function onRequestWikiQueueFormDescriptorModify( 'class' => HTMLToggleSwitchField::class, 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', + 'filter-callback' fn ( mixed $test ): mixed => true; 'section' => 'editing/advanced', 'default' => $isAdvancedModified, + 'disabled' => $isAdvancedModified, 'disable-if' => [ 'AND', [ '===', 'edit-showadvanced', '1' ], From a8284a4cc620c66bed47905f536a03bf66f44b4a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:26:01 -0600 Subject: [PATCH 126/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index c4717f8e5..8d6ab1304 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -445,7 +445,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'class' => HTMLToggleSwitchField::class, 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', - 'filter-callback' fn ( mixed $test ): mixed => true; + 'filter-callback' fn ( mixed $test ): mixed => true, 'section' => 'editing/advanced', 'default' => $isAdvancedModified, 'disabled' => $isAdvancedModified, From b830444590037cf69b2cda884693ca2d1539e4d3 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:26:37 -0600 Subject: [PATCH 127/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8d6ab1304..8d21dbfeb 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -445,7 +445,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'class' => HTMLToggleSwitchField::class, 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', - 'filter-callback' fn ( mixed $test ): mixed => true, + 'filter-callback' => fn ( mixed $test ): mixed => true, 'section' => 'editing/advanced', 'default' => $isAdvancedModified, 'disabled' => $isAdvancedModified, From eea7272897306d1029451c713a7870b5e95bf14f Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:29:42 -0600 Subject: [PATCH 128/162] Fix --- includes/HookHandlers/RequestWiki.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8d21dbfeb..7644f0de2 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -445,10 +445,9 @@ public function onRequestWikiQueueFormDescriptorModify( 'class' => HTMLToggleSwitchField::class, 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', - 'filter-callback' => fn ( mixed $test ): mixed => true, 'section' => 'editing/advanced', 'default' => $isAdvancedModified, - 'disabled' => $isAdvancedModified, + 'readonly' => $isAdvancedModified, 'disable-if' => [ 'AND', [ '===', 'edit-showadvanced', '1' ], From e12aa4374490f0929d2dc3c4f3b9cad26ab26920 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:32:08 -0600 Subject: [PATCH 129/162] Try --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7644f0de2..b1dbba5f8 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -447,7 +447,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', 'default' => $isAdvancedModified, - 'readonly' => $isAdvancedModified, + 'disabled' => $isAdvancedModified, 'disable-if' => [ 'AND', [ '===', 'edit-showadvanced', '1' ], @@ -466,7 +466,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', - 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ] + [ 'NOT', [ $formDescriptor['edit-showadvanced']['disable-if' ] ], 'section' => 'editing/advanced', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), From ac30f1e50adc2556f2c0e5d6f6f58371da593948 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:33:04 -0600 Subject: [PATCH 130/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index b1dbba5f8..975c951ce 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -466,7 +466,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', - 'hide-if' => [ '!==', 'edit-showadvanced', '1' ] + [ 'NOT', [ $formDescriptor['edit-showadvanced']['disable-if' ] ], + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ] + [ 'NOT', [ $formDescriptor['edit-showadvanced']['disable-if'] ] ], 'section' => 'editing/advanced', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), From f5d1ba880438cbcfd5dff8a1e4f4fee0ab33de8c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:36:04 -0600 Subject: [PATCH 131/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 975c951ce..2fd108f34 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -466,7 +466,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', - 'hide-if' => [ '!==', 'edit-showadvanced', '1' ] + [ 'NOT', [ $formDescriptor['edit-showadvanced']['disable-if'] ] ], + 'hide-if' => [ 'AND', [ '!==', 'edit-showadvanced', '1' ] + [ 'NOT', [ $formDescriptor['edit-showadvanced']['disable-if'] ] ] ], 'section' => 'editing/advanced', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), From 70da2f8ea8f7774dd18ee1ea2ddd304d48a6fa37 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:37:45 -0600 Subject: [PATCH 132/162] Remove --- includes/HookHandlers/RequestWiki.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 2fd108f34..f07bba06c 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -448,15 +448,6 @@ public function onRequestWikiQueueFormDescriptorModify( 'section' => 'editing/advanced', 'default' => $isAdvancedModified, 'disabled' => $isAdvancedModified, - 'disable-if' => [ - 'AND', - [ '===', 'edit-showadvanced', '1' ], - [ - 'OR', - [ '===', 'edit-mainpageroot', '1' ], - [ '!==', 'edit-articlepath', '/wiki/$1' ], - ], - ], ] ); @@ -466,7 +457,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', - 'hide-if' => [ 'AND', [ '!==', 'edit-showadvanced', '1' ] + [ 'NOT', [ $formDescriptor['edit-showadvanced']['disable-if'] ] ] ], + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'section' => 'editing/advanced', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), From 7d7f78a44c97d9fe912e8dafab7b9f9c884d88ee Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:42:48 -0600 Subject: [PATCH 133/162] Don't save showadvanced --- includes/HookHandlers/RequestWiki.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index f07bba06c..243c73454 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -134,6 +134,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'advanced', + // We handle this manually, we don't want to save this field + 'save' => false, ] ); From 803cdf271f91700d257e6b9206b0c37dd7d0c6c3 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:46:41 -0600 Subject: [PATCH 134/162] Test --- includes/HookHandlers/RequestWiki.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 243c73454..3e892ed73 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -47,6 +47,8 @@ public static function factory( Config $mainConfig ): self { } public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { + $formDescriptor['purpose']['options'] = [ 'test' => $formDescriptor['purpose']['options'] ]; + $formDescriptor['purpose']['flatlist'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', From c30d8a8079719c64884513a5c7c99ded9e3ea186 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:47:50 -0600 Subject: [PATCH 135/162] test --- includes/HookHandlers/RequestWiki.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 3e892ed73..a252a8964 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -48,6 +48,7 @@ public static function factory( Config $mainConfig ): self { public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { $formDescriptor['purpose']['options'] = [ 'test' => $formDescriptor['purpose']['options'] ]; + $formDescriptor['purpose']['default'] = 'test'; $formDescriptor['purpose']['flatlist'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, From 3fb3e6c97461f16edf90275344684e4e689610b3 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:48:27 -0600 Subject: [PATCH 136/162] Try --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index a252a8964..21ccc78f3 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -48,7 +48,7 @@ public static function factory( Config $mainConfig ): self { public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { $formDescriptor['purpose']['options'] = [ 'test' => $formDescriptor['purpose']['options'] ]; - $formDescriptor['purpose']['default'] = 'test'; + $formDescriptor['purpose']['default'] = ''; $formDescriptor['purpose']['flatlist'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, From 37ac20a3ef0ddf340c106230be8039a091233097 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:52:48 -0600 Subject: [PATCH 137/162] test --- includes/HookHandlers/RequestWiki.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 21ccc78f3..8e902e04f 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -47,9 +47,8 @@ public static function factory( Config $mainConfig ): self { } public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { - $formDescriptor['purpose']['options'] = [ 'test' => $formDescriptor['purpose']['options'] ]; + $formDescriptor['purpose']['options'] = [ '' => 'test' ] + $formDescriptor['purpose']['options']; $formDescriptor['purpose']['default'] = ''; - $formDescriptor['purpose']['flatlist'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', From 0c7876a03fe9eea6453683b1e1145e3bd3100184 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:53:52 -0600 Subject: [PATCH 138/162] Try --- includes/HookHandlers/RequestWiki.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 8e902e04f..7fdc2d502 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -47,8 +47,9 @@ public static function factory( Config $mainConfig ): self { } public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { - $formDescriptor['purpose']['options'] = [ '' => 'test' ] + $formDescriptor['purpose']['options']; + $formDescriptor['purpose']['options'] = [ 'Select an option' => '' ] + $formDescriptor['purpose']['options']; $formDescriptor['purpose']['default'] = ''; + $formDescriptor['purpose']['required'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', From a309bb1f786d1400a80f8ceeede663dea3d34974 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 16:57:00 -0600 Subject: [PATCH 139/162] - --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 7fdc2d502..aaf2fafff 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -48,8 +48,8 @@ public static function factory( Config $mainConfig ): self { public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { $formDescriptor['purpose']['options'] = [ 'Select an option' => '' ] + $formDescriptor['purpose']['options']; - $formDescriptor['purpose']['default'] = ''; - $formDescriptor['purpose']['required'] = true; + // $formDescriptor['purpose']['default'] = ''; + // $formDescriptor['purpose']['required'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', From 7d4431073805ee6bd0293725c279d9008a589de5 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 17:01:43 -0600 Subject: [PATCH 140/162] - --- includes/HookHandlers/RequestWiki.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index aaf2fafff..243c73454 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -47,9 +47,6 @@ public static function factory( Config $mainConfig ): self { } public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): void { - $formDescriptor['purpose']['options'] = [ 'Select an option' => '' ] + $formDescriptor['purpose']['options']; - // $formDescriptor['purpose']['default'] = ''; - // $formDescriptor['purpose']['required'] = true; RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'nsfw', From 83d73cbd6afa2cf1201ece7a38c9a2b3bf6ae6f0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 17:14:04 -0600 Subject: [PATCH 141/162] Update --- includes/HookHandlers/RequestWiki.php | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 243c73454..89d728b41 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -54,7 +54,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-nsfw', 'help-message' => 'requestwiki-help-nsfw', 'help-inline' => false, - 'section' => 'info', + 'section' => 'request-info', 'cssclass' => 'createwiki-infuse', 'type' => 'check', ] @@ -68,7 +68,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'hide-if' => [ '!==', 'nsfw', '1' ], 'cssclass' => 'createwiki-infuse', 'required' => true, - 'section' => 'info', + 'section' => 'request-info', 'type' => 'text', ] ); @@ -78,7 +78,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newKey: 'source', newField: [ 'label-message' => 'requestwiki-label-source', - 'section' => 'info', + 'section' => 'request-info', 'cssclass' => 'createwiki-infuse', 'type' => 'check', ] @@ -92,7 +92,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'hide-if' => [ '!==', 'source', '1' ], 'cssclass' => 'createwiki-infuse', 'required' => true, - 'section' => 'info', + 'section' => 'request-info', 'type' => 'url', ] ); @@ -220,25 +220,25 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'guidance', - newSection: 'info' + newSection: 'request-info' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'purpose', - newSection: 'info' + newSection: 'request-info' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'reason', - newSection: 'info' + newSection: 'request-info' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'bio', - newSection: 'info' + newSection: 'request-info' ); RequestWikiFormUtils::moveFieldToSection( @@ -303,7 +303,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi RequestWikiFormUtils::reorderFieldsInSection( $formDescriptor, - section: 'info', + section: 'request-info', newOrder: [ 'guidance', 'purpose', @@ -358,7 +358,7 @@ public function onRequestWikiQueueFormDescriptorModify( newKey: 'edit-nsfw', newField: [ 'label-message' => 'requestwiki-label-nsfw', - 'section' => 'editing/basic', + 'section' => 'editing/request-info', 'type' => 'check', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), @@ -372,7 +372,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'edit-nsfw', '1' ], 'cssclass' => 'createwiki-infuse', - 'section' => 'editing/basic', + 'section' => 'editing/request-info', 'required' => true, 'type' => 'text', 'default' => $wikiRequestManager->getExtraFieldData( 'nsfwtext' ), @@ -384,7 +384,7 @@ public function onRequestWikiQueueFormDescriptorModify( newKey: 'edit-source', newField: [ 'label-message' => 'requestwiki-label-source', - 'section' => 'editing/basic', + 'section' => 'editing/request-info', 'type' => 'check', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'source' ), @@ -398,7 +398,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'edit-source', '1' ], 'cssclass' => 'createwiki-infuse', - 'section' => 'editing/basic', + 'section' => 'editing/request-info', 'required' => true, 'type' => 'url', 'default' => $wikiRequestManager->getExtraFieldData( 'sourceurl' ), @@ -534,19 +534,19 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'edit-purpose', - newSection: 'editing/basic' + newSection: 'editing/request-info' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'edit-description', - newSection: 'editing/basic' + newSection: 'editing/request-info' ); RequestWikiFormUtils::moveFieldToSection( $formDescriptor, fieldKey: 'edit-bio', - newSection: 'editing/basic' + newSection: 'editing/request-info' ); RequestWikiFormUtils::moveFieldToSection( @@ -567,7 +567,7 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::reorderFieldsInSection( $formDescriptor, - section: 'editing/basic', + section: 'editing/request-info', newOrder: [ 'edit-purpose', 'edit-bio', From 7d6a2324996750fb5b894a3ee80c7036449547ab Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 17:15:38 -0600 Subject: [PATCH 142/162] Update --- i18n/miraheze/en.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/i18n/miraheze/en.json b/i18n/miraheze/en.json index 2ed5a9951..f58998850 100644 --- a/i18n/miraheze/en.json +++ b/i18n/miraheze/en.json @@ -214,7 +214,12 @@ "requestwiki-configure": "Wiki configuration", "requestwiki-confirmation": "Confirmation", "requestwiki-core": "Core settings", - "requestwiki-info": "Request information", + "requestwiki-request-info": "Request information", + "requestwikiqueue-advanced": "Advanced configuration", + "requestwikiqueue-configure": "Wiki configuration", + "requestwikiqueue-confirmation": "Confirmation", + "requestwikiqueue-core": "Core settings", + "requestwikiqueue-request-info": "Request information", "restriction-delete": "Delete", "restriction-level-user": "Allow only logged in users", "right-user": "Edit pages protected as \"{{int:protect-level-user}}\"", From bdf74adb6276d6b0ce486cb76328b76771fec8e2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 17:17:24 -0600 Subject: [PATCH 143/162] Fix --- i18n/miraheze/en.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/i18n/miraheze/en.json b/i18n/miraheze/en.json index f58998850..3fca4f3e2 100644 --- a/i18n/miraheze/en.json +++ b/i18n/miraheze/en.json @@ -215,11 +215,10 @@ "requestwiki-confirmation": "Confirmation", "requestwiki-core": "Core settings", "requestwiki-request-info": "Request information", - "requestwikiqueue-advanced": "Advanced configuration", - "requestwikiqueue-configure": "Wiki configuration", - "requestwikiqueue-confirmation": "Confirmation", - "requestwikiqueue-core": "Core settings", - "requestwikiqueue-request-info": "Request information", + "requestwikiqueue-section-advanced": "Advanced configuration", + "requestwikiqueue-section-configure": "Wiki configuration", + "requestwikiqueue-section-core": "Core settings", + "requestwikiqueue-section-request-info": "Request information", "restriction-delete": "Delete", "restriction-level-user": "Allow only logged in users", "right-user": "Edit pages protected as \"{{int:protect-level-user}}\"", From 5482d764ae21872b51cd9c7afe8cc6861755e9a6 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 17:19:28 -0600 Subject: [PATCH 144/162] Test --- extension.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.json b/extension.json index c97e21ed1..13634c479 100644 --- a/extension.json +++ b/extension.json @@ -174,7 +174,7 @@ }, "MirahezeMagicRequestWikiSkins": { "description": "Array. Skins to allow to select directly from RequestWiki.", - "value": [ "vector", "vector-2022" ] + "value": [ "cosmos", "vector", "vector-2022" ] }, "MirahezeReportsBlockAlertKeywords": { "description": "Array. Words in block reasons which trigger a report being sent to TSPortal.", From 9a2aaaec98da88316d242105eead95258273075b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 17:31:24 -0600 Subject: [PATCH 145/162] Fix --- includes/HookHandlers/RequestWiki.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 89d728b41..112a68f02 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -670,7 +670,7 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string if ( $extraData['defaultskin'] !== ( $setList['wgDefaultSkin'] ?? 'vector-2022' ) ) { if ( !isset( $extList[ $extraData['defaultskin'] ] ) && - in_array( + array_key_exists( $extraData['defaultskin'], $this->options->get( 'ManageWikiExtensions' ) ) From f10f9d808f6ebffb89da9a4e007fa9c0689fe1dd Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 15 Oct 2024 20:52:42 -0600 Subject: [PATCH 146/162] Remove --- includes/HookHandlers/RequestWiki.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 112a68f02..77025c78e 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -267,12 +267,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newProperties: [ 'label-message' => 'requestwiki-label-category' ] ); - RequestWikiFormUtils::updateFieldProperties( - $formDescriptor, - fieldKey: 'reason', - newProperties: [ 'useeditfont' => true ] - ); - RequestWikiFormUtils::updateFieldProperties( $formDescriptor, fieldKey: 'subdomain', From b949911cde839bd3e728a264021c0bcb6cc9c69a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Wed, 16 Oct 2024 15:25:21 -0600 Subject: [PATCH 147/162] Use DetailsWithIconField --- includes/HookHandlers/RequestWiki.php | 55 +++++---------------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 77025c78e..dc965f9c9 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,19 +4,16 @@ use MediaWiki\Config\Config; use MediaWiki\Config\ServiceOptions; -use MediaWiki\Context\IContextSource; -use MediaWiki\Context\RequestContext; use MediaWiki\HTMLForm\Field\HTMLToggleSwitchField; use MediaWiki\User\User; use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraDataHook; use Miraheze\CreateWiki\Hooks\RequestWikiFormDescriptorModifyHook; use Miraheze\CreateWiki\Hooks\RequestWikiQueueFormDescriptorModifyHook; +use Miraheze\CreateWiki\RequestWiki\FormFields\DetailsWithIconField; use Miraheze\CreateWiki\RequestWiki\RequestWikiFormUtils; use Miraheze\CreateWiki\Services\WikiRequestManager; use Miraheze\ManageWiki\Helpers\ManageWikiExtensions; use Miraheze\ManageWiki\Helpers\ManageWikiSettings; -use OOUI\IconWidget; -use OOUI\Tag; class RequestWiki implements CreateWikiAfterCreationWithExtraDataHook, @@ -24,17 +21,14 @@ class RequestWiki implements RequestWikiQueueFormDescriptorModifyHook { - private IContextSource $context; private ServiceOptions $options; - public function __construct( IContextSource $context, ServiceOptions $options ) { - $this->context = $context; + public function __construct( ServiceOptions $options ) { $this->options = $options; } public static function factory( Config $mainConfig ): self { return new self( - RequestContext::getMain(), new ServiceOptions( [ 'ManageWikiExtensions', @@ -605,36 +599,27 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - // We need to make sure we have OOUI enabled for IconWidget - $this->context->getOutput()->enableOOUI(); - - $isNsfw = (bool)$wikiRequestManager->getExtraFieldData( 'nsfw' ); - RequestWikiFormUtils::insertFieldAfter( $formDescriptor, - afterKey: 'details-description', - newKey: 'details-nsfw', + afterKey: 'private', + newKey: 'nsfw', newField: [ + 'class' => DetailsWithIconField::class, 'label-message' => 'requestwiki-label-nsfw', - 'type' => 'info', + 'fieldCheck' => $wikiRequestManager->getExtraFieldData( 'nsfw' ), 'section' => 'details', - 'raw' => true, - 'default' => $this->getDetailsWithIcon( $isNsfw ), ] ); - $hasSource = (bool)$wikiRequestManager->getExtraFieldData( 'source' ); - RequestWikiFormUtils::insertFieldAfter( $formDescriptor, - afterKey: 'details-purpose', - newKey: 'details-source', + afterKey: 'nsfw', + newKey: 'source', newField: [ + 'class' => DetailsWithIconField::class, 'label-message' => 'requestwiki-label-source', - 'type' => 'info', + 'fieldCheck' => $wikiRequestManager->getExtraFieldData( 'source' ), 'section' => 'details', - 'raw' => true, - 'default' => $this->getDetailsWithIcon( $hasSource ), ] ); } @@ -682,24 +667,4 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwExtensions->commit(); } } - - private function getDetailsWithIcon( bool $fieldCheck ): string { - if ( $fieldCheck ) { - return new IconWidget( [ - 'icon' => 'check', - 'flags' => 'success', - ] ) . ' ' . - ( new Tag( 'b' ) )->appendContent( - $this->context->msg( 'htmlform-yes' )->escaped() - ); - } - - return new IconWidget( [ - 'icon' => 'close', - 'flags' => 'progressive', - ] ) . ' ' . - ( new Tag( 'b' ) )->appendContent( - $this->context->msg( 'htmlform-no' )->escaped() - ); - } } From b146117ee2118278bf8dd4cbd8004eef15331ae6 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Wed, 16 Oct 2024 19:31:18 -0600 Subject: [PATCH 148/162] Add some comments --- includes/HookHandlers/RequestWiki.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 15d955924..04f958c22 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -586,12 +586,15 @@ public function onRequestWikiQueueFormDescriptorModify( 'edit-mainpageroot', 'edit-articlepath', 'edit-defaultextensions', + // We put the edit button in advanced + // just so it appears at the bottom. 'submit-edit', ] ); RequestWikiFormUtils::reorderSections( $formDescriptor, + // Everything else will be appended after newSectionOrder: [ 'details', 'comments', From ebbdb1e572e4dfd762da31c83ea8b6e7ce4150ab Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Wed, 16 Oct 2024 20:05:04 -0600 Subject: [PATCH 149/162] Use reason --- includes/HookHandlers/RequestWiki.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 04f958c22..13978f602 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -527,7 +527,7 @@ public function onRequestWikiQueueFormDescriptorModify( RequestWikiFormUtils::moveFieldToSection( $formDescriptor, - fieldKey: 'edit-description', + fieldKey: 'edit-reason', newSection: 'editing/request-info' ); @@ -563,7 +563,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'edit-source', 'edit-nsfwtext', 'edit-sourceurl', - 'edit-description', + 'edit-reason', ] ); From 28b17a70102de4f9036d4be277550a91e8622d27 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Thu, 17 Oct 2024 10:43:46 -0600 Subject: [PATCH 150/162] Update message --- extension.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.json b/extension.json index 13634c479..11ee6d567 100644 --- a/extension.json +++ b/extension.json @@ -173,7 +173,7 @@ "value": [ "pageimages" ] }, "MirahezeMagicRequestWikiSkins": { - "description": "Array. Skins to allow to select directly from RequestWiki.", + "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki.", "value": [ "cosmos", "vector", "vector-2022" ] }, "MirahezeReportsBlockAlertKeywords": { From e7a57ebf6afec4f6dff224b8d4914f59ba60d66a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 22 Oct 2024 11:26:03 -0600 Subject: [PATCH 151/162] Update --- includes/HookHandlers/RequestWiki.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 13978f602..37498a095 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -49,7 +49,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'help-message' => 'requestwiki-help-nsfw', 'help-inline' => false, 'section' => 'request-info', - 'cssclass' => 'createwiki-infuse', 'type' => 'check', ] ); @@ -60,7 +59,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-nsfwtext', 'hide-if' => [ '!==', 'nsfw', '1' ], - 'cssclass' => 'createwiki-infuse', 'required' => true, 'section' => 'request-info', 'type' => 'text', @@ -73,7 +71,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-source', 'section' => 'request-info', - 'cssclass' => 'createwiki-infuse', 'type' => 'check', ] ); @@ -84,7 +81,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'label-message' => 'requestwiki-label-sourceurl', 'hide-if' => [ '!==', 'source', '1' ], - 'cssclass' => 'createwiki-infuse', 'required' => true, 'section' => 'request-info', 'type' => 'url', @@ -102,7 +98,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $this->options->get( 'MirahezeMagicRequestWikiSkins' ) ), 'default' => 'vector-2022', - 'cssclass' => 'createwiki-infuse', 'section' => 'configure', ] ); @@ -115,7 +110,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'maxlength' => 512, 'label-message' => 'requestwiki-label-wddescription', 'help-message' => 'requestwiki-help-wddescription', - 'cssclass' => 'createwiki-infuse', 'section' => 'configure', ] ); @@ -125,7 +119,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newKey: 'showadvanced', newField: [ 'class' => HTMLToggleSwitchField::class, - 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'advanced', // We handle this manually, we don't want to save this field @@ -139,8 +132,8 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'type' => 'check', 'label-message' => 'miraheze-label-managewiki-mainpage-is-domain-root', + 'help-message' => 'miraheze-help-managewiki-mainpage-is-domain-root', 'hide-if' => [ '!==', 'showadvanced', '1' ], - 'cssclass' => 'createwiki-infuse', 'section' => 'advanced', ] ); @@ -156,7 +149,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'miraheze-label-managewiki-article-path-root' => '/$1', ], 'hide-if' => [ '!==', 'showadvanced', '1' ], - 'cssclass' => 'createwiki-infuse', 'default' => '/wiki/$1', 'section' => 'advanced', ] @@ -175,7 +167,6 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) ), 'hide-if' => [ '!==', 'showadvanced', '1' ], - 'cssclass' => 'createwiki-infuse', 'dropdown' => true, 'section' => 'advanced', ] @@ -430,14 +421,14 @@ public function onRequestWikiQueueFormDescriptorModify( $formDescriptor, newKey: 'edit-showadvanced', newField: [ - // We handle this manually, we don't want to save this field - 'save' => false, 'class' => HTMLToggleSwitchField::class, 'cssclass' => 'createwiki-infuse', 'label-message' => 'requestwiki-label-showadvanced', 'section' => 'editing/advanced', 'default' => $isAdvancedModified, 'disabled' => $isAdvancedModified, + // We handle this manually, we don't want to save this field + 'save' => false, ] ); From af34e730f1888be2ff50b9eb54901e9489210973 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Thu, 24 Oct 2024 17:14:18 -0600 Subject: [PATCH 152/162] Remove dummy configs --- extension.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension.json b/extension.json index 11ee6d567..7e10b4652 100644 --- a/extension.json +++ b/extension.json @@ -170,11 +170,11 @@ }, "MirahezeMagicRequestWikiExtensions": { "description": "Array. Extensions to allow to select directly from RequestWiki.", - "value": [ "pageimages" ] + "value": [] }, "MirahezeMagicRequestWikiSkins": { "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki.", - "value": [ "cosmos", "vector", "vector-2022" ] + "value": [ "vector", "vector-2022" ] }, "MirahezeReportsBlockAlertKeywords": { "description": "Array. Words in block reasons which trigger a report being sent to TSPortal.", From 8b47f8e62c843688f8a73ce9d0f92bd8072de422 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Thu, 24 Oct 2024 17:26:00 -0600 Subject: [PATCH 153/162] Associative arrays --- includes/HookHandlers/RequestWiki.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 37498a095..b054bf4e8 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -93,10 +93,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'type' => 'select', 'label-message' => 'requestwiki-label-defaultskin', - 'options' => array_combine( - $this->options->get( 'MirahezeMagicRequestWikiSkins' ), - $this->options->get( 'MirahezeMagicRequestWikiSkins' ) - ), + 'options' => $this->options->get( 'MirahezeMagicRequestWikiSkins' ), 'default' => 'vector-2022', 'section' => 'configure', ] @@ -162,10 +159,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-defaultextensions', 'help-message' => 'requestwiki-help-defaultextensions', 'help-inline' => false, - 'options' => array_combine( - $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), - $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) - ), + 'options' => $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), 'hide-if' => [ '!==', 'showadvanced', '1' ], 'dropdown' => true, 'section' => 'advanced', @@ -390,10 +384,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'select', 'label-message' => 'requestwiki-label-defaultskin', - 'options' => array_combine( - $this->options->get( 'MirahezeMagicRequestWikiSkins' ), - $this->options->get( 'MirahezeMagicRequestWikiSkins' ) - ), + 'options' => $this->options->get( 'MirahezeMagicRequestWikiSkins' ), 'section' => 'editing/configure', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'defaultskin' ) ?? 'vector-2022', @@ -468,10 +459,7 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'multiselect', 'label-message' => 'requestwiki-label-defaultextensions', - 'options' => array_combine( - $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), - $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) - ), + 'options' => $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'dropdown' => true, 'section' => 'editing/advanced', From 06c2ce8110657995636365c1d853c079a46e2bf0 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Thu, 24 Oct 2024 17:30:09 -0600 Subject: [PATCH 154/162] Use key-value --- extension.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extension.json b/extension.json index 7e10b4652..bfda302ea 100644 --- a/extension.json +++ b/extension.json @@ -174,7 +174,10 @@ }, "MirahezeMagicRequestWikiSkins": { "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki.", - "value": [ "vector", "vector-2022" ] + "value": { + "vector": "Vector", + "vector-2022": "Vector (2022)" + } }, "MirahezeReportsBlockAlertKeywords": { "description": "Array. Words in block reasons which trigger a report being sent to TSPortal.", From a7fbe9c984dc19c5f9d0438f6cee7c1505dad3b2 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Fri, 25 Oct 2024 16:20:31 -0600 Subject: [PATCH 155/162] Remove mainpageroot for now --- includes/HookHandlers/RequestWiki.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index b054bf4e8..0f85299c4 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -123,7 +123,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::addFieldToEnd( + /* RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'mainpageroot', newField: [ @@ -133,7 +133,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'hide-if' => [ '!==', 'showadvanced', '1' ], 'section' => 'advanced', ] - ); + ); */ RequestWikiFormUtils::addFieldToEnd( $formDescriptor, @@ -305,7 +305,7 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi section: 'advanced', newOrder: [ 'showadvanced', - 'mainpageroot', + // 'mainpageroot', 'articlepath', 'defaultextensions', ] @@ -423,7 +423,7 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - RequestWikiFormUtils::addFieldToEnd( + /* RequestWikiFormUtils::addFieldToEnd( $formDescriptor, newKey: 'edit-mainpageroot', newField: [ @@ -434,7 +434,7 @@ public function onRequestWikiQueueFormDescriptorModify( 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'mainpageroot' ), ] - ); + ); */ RequestWikiFormUtils::addFieldToEnd( $formDescriptor, @@ -562,7 +562,7 @@ public function onRequestWikiQueueFormDescriptorModify( section: 'editing/advanced', newOrder: [ 'edit-showadvanced', - 'edit-mainpageroot', + // 'edit-mainpageroot', 'edit-articlepath', 'edit-defaultextensions', // We put the edit button in advanced @@ -618,10 +618,10 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwSettings->commit(); } - if ( $extraData['mainpageroot'] !== ( $setList['wgMainPageIsDomainRoot'] ?? false ) ) { + /* if ( $extraData['mainpageroot'] !== ( $setList['wgMainPageIsDomainRoot'] ?? false ) ) { $mwSettings->modify( [ 'wgMainPageIsDomainRoot' => $extraData['mainpageroot'] ] ); $mwSettings->commit(); - } + } */ if ( $extraData['wddescription'] !== ( $setList['wgWikiDiscoverDescription'] ?? '' ) ) { $mwSettings->modify( [ 'wgWikiDiscoverDescription' => $extraData['wddescription'] ] ); From c2b4f83f655b8afdb629af76a7e631906ef84e0b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 12:03:21 -0600 Subject: [PATCH 156/162] Add format to config descriptions --- extension.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension.json b/extension.json index bfda302ea..188977ce4 100644 --- a/extension.json +++ b/extension.json @@ -169,11 +169,11 @@ "value": [] }, "MirahezeMagicRequestWikiExtensions": { - "description": "Array. Extensions to allow to select directly from RequestWiki.", + "description": "Array. Extensions to allow to select directly from RequestWiki, formatted as key (index from $wgManageWikiExtensions) => display name.", "value": [] }, "MirahezeMagicRequestWikiSkins": { - "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki.", + "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki, formatted as skin key => display name.", "value": { "vector": "Vector", "vector-2022": "Vector (2022)" From 2ae955ea4744f722b5a826b0538e10820112097c Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 12:36:34 -0600 Subject: [PATCH 157/162] Add support for localized options --- includes/HookHandlers/RequestWiki.php | 43 +++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 0f85299c4..3d5f2955d 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -4,8 +4,10 @@ use MediaWiki\Config\Config; use MediaWiki\Config\ServiceOptions; +use MediaWiki\Context\RequestContext; use MediaWiki\HTMLForm\Field\HTMLToggleSwitchField; use MediaWiki\User\User; +use MessageLocalizer; use Miraheze\CreateWiki\Hooks\CreateWikiAfterCreationWithExtraDataHook; use Miraheze\CreateWiki\Hooks\RequestWikiFormDescriptorModifyHook; use Miraheze\CreateWiki\Hooks\RequestWikiQueueFormDescriptorModifyHook; @@ -21,14 +23,20 @@ class RequestWiki implements RequestWikiQueueFormDescriptorModifyHook { + private MessageLocalizer $messageLocalizer; private ServiceOptions $options; - public function __construct( ServiceOptions $options ) { + public function __construct( + MessageLocalizer $messageLocalizer, + ServiceOptions $options + ) { + $this->messageLocalizer = $messageLocalizer; $this->options = $options; } public static function factory( Config $mainConfig ): self { return new self( + RequestContext::getMain(), new ServiceOptions( [ 'ManageWikiExtensions', @@ -93,7 +101,9 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi newField: [ 'type' => 'select', 'label-message' => 'requestwiki-label-defaultskin', - 'options' => $this->options->get( 'MirahezeMagicRequestWikiSkins' ), + 'options' => $this->buildLocalizedOptions( + $this->options->get( 'MirahezeMagicRequestWikiSkins' ) + ), 'default' => 'vector-2022', 'section' => 'configure', ] @@ -159,7 +169,9 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi 'label-message' => 'requestwiki-label-defaultextensions', 'help-message' => 'requestwiki-help-defaultextensions', 'help-inline' => false, - 'options' => $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), + 'options' => $this->buildLocalizedOptions( + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) + ), 'hide-if' => [ '!==', 'showadvanced', '1' ], 'dropdown' => true, 'section' => 'advanced', @@ -384,7 +396,9 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'select', 'label-message' => 'requestwiki-label-defaultskin', - 'options' => $this->options->get( 'MirahezeMagicRequestWikiSkins' ), + 'options' => $this->buildLocalizedOptions( + $this->options->get( 'MirahezeMagicRequestWikiSkins' ) + ), 'section' => 'editing/configure', 'cssclass' => 'createwiki-infuse', 'default' => $wikiRequestManager->getExtraFieldData( 'defaultskin' ) ?? 'vector-2022', @@ -459,7 +473,9 @@ public function onRequestWikiQueueFormDescriptorModify( newField: [ 'type' => 'multiselect', 'label-message' => 'requestwiki-label-defaultextensions', - 'options' => $this->options->get( 'MirahezeMagicRequestWikiExtensions' ), + 'options' => $this->buildLocalizedOptions( + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) + ), 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], 'dropdown' => true, 'section' => 'editing/advanced', @@ -649,4 +665,21 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string $mwExtensions->commit(); } } + + private function buildLocalizedOptions( array $options ): array { + $localizedOptions = []; + + foreach ( $options as $key => $displayName ) { + $localizedMessage = $this->messageLocalizer->msg( $displayName ); + + if ( !$localizedMessage->isDisabled() ) { + $localizedOptions[$key] = $localizedMessage->text(); + continue; + } + + $localizedOptions[$key] = $displayName; + } + + return $localizedOptions; + } } From 4034a02426c8b77e1a59ecab91efd5251f58525b Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 12:37:34 -0600 Subject: [PATCH 158/162] Add note that value can be a message key --- extension.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension.json b/extension.json index 188977ce4..d22b20cd1 100644 --- a/extension.json +++ b/extension.json @@ -169,11 +169,11 @@ "value": [] }, "MirahezeMagicRequestWikiExtensions": { - "description": "Array. Extensions to allow to select directly from RequestWiki, formatted as key (index from $wgManageWikiExtensions) => display name.", + "description": "Array. Extensions to allow to select directly from RequestWiki, formatted as key (index from $wgManageWikiExtensions) => display name or message key.", "value": [] }, "MirahezeMagicRequestWikiSkins": { - "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki, formatted as skin key => display name.", + "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki, formatted as skin key => display name or message key.", "value": { "vector": "Vector", "vector-2022": "Vector (2022)" From 869a49b37926dfda864b2a31fc9f510b985d8e90 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 12:42:21 -0600 Subject: [PATCH 159/162] Use messages --- extension.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension.json b/extension.json index d22b20cd1..7734b9fa7 100644 --- a/extension.json +++ b/extension.json @@ -175,8 +175,8 @@ "MirahezeMagicRequestWikiSkins": { "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki, formatted as skin key => display name or message key.", "value": { - "vector": "Vector", - "vector-2022": "Vector (2022)" + "vector": "skinname-vector", + "vector-2022": "skinname-vector-2022" } }, "MirahezeReportsBlockAlertKeywords": { From 84dedbbbba3f6bf7ac6507c755de078987749f7a Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 13:02:33 -0600 Subject: [PATCH 160/162] Add check if extensions are set --- includes/HookHandlers/RequestWiki.php | 68 ++++++++++++++------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index 3d5f2955d..abbf12d77 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -161,22 +161,24 @@ public function onRequestWikiFormDescriptorModify( array &$formDescriptor ): voi ] ); - RequestWikiFormUtils::addFieldToEnd( - $formDescriptor, - newKey: 'defaultextensions', - newField: [ - 'type' => 'multiselect', - 'label-message' => 'requestwiki-label-defaultextensions', - 'help-message' => 'requestwiki-help-defaultextensions', - 'help-inline' => false, - 'options' => $this->buildLocalizedOptions( - $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) - ), - 'hide-if' => [ '!==', 'showadvanced', '1' ], - 'dropdown' => true, - 'section' => 'advanced', - ] - ); + if ( $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) ) { + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'defaultextensions', + newField: [ + 'type' => 'multiselect', + 'label-message' => 'requestwiki-label-defaultextensions', + 'help-message' => 'requestwiki-help-defaultextensions', + 'help-inline' => false, + 'options' => $this->buildLocalizedOptions( + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) + ), + 'hide-if' => [ '!==', 'showadvanced', '1' ], + 'dropdown' => true, + 'section' => 'advanced', + ] + ); + } RequestWikiFormUtils::moveFieldToSection( $formDescriptor, @@ -467,22 +469,24 @@ public function onRequestWikiQueueFormDescriptorModify( ] ); - RequestWikiFormUtils::addFieldToEnd( - $formDescriptor, - newKey: 'edit-defaultextensions', - newField: [ - 'type' => 'multiselect', - 'label-message' => 'requestwiki-label-defaultextensions', - 'options' => $this->buildLocalizedOptions( - $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) - ), - 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], - 'dropdown' => true, - 'section' => 'editing/advanced', - 'cssclass' => 'createwiki-infuse', - 'default' => $wikiRequestManager->getExtraFieldData( 'defaultextensions' ), - ] - ); + if ( $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) ) { + RequestWikiFormUtils::addFieldToEnd( + $formDescriptor, + newKey: 'edit-defaultextensions', + newField: [ + 'type' => 'multiselect', + 'label-message' => 'requestwiki-label-defaultextensions', + 'options' => $this->buildLocalizedOptions( + $this->options->get( 'MirahezeMagicRequestWikiExtensions' ) + ), + 'hide-if' => [ '!==', 'edit-showadvanced', '1' ], + 'dropdown' => true, + 'section' => 'editing/advanced', + 'cssclass' => 'createwiki-infuse', + 'default' => $wikiRequestManager->getExtraFieldData( 'defaultextensions' ), + ] + ); + } RequestWikiFormUtils::moveFieldToSection( $formDescriptor, From e548632aa6c60b9c94b23bfd0079e0fda389bc60 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 13:23:58 -0600 Subject: [PATCH 161/162] Fix --- extension.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extension.json b/extension.json index 7734b9fa7..54f740642 100644 --- a/extension.json +++ b/extension.json @@ -169,14 +169,14 @@ "value": [] }, "MirahezeMagicRequestWikiExtensions": { - "description": "Array. Extensions to allow to select directly from RequestWiki, formatted as key (index from $wgManageWikiExtensions) => display name or message key.", + "description": "Array. Extensions to allow to select directly from RequestWiki, formatted as display name or message key => extension key (index from $wgManageWikiExtensions).", "value": [] }, "MirahezeMagicRequestWikiSkins": { - "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki, formatted as skin key => display name or message key.", + "description": "Array. Skins to allow to be selected as the default skin directly from RequestWiki, formatted as display name or message key => skin key.", "value": { - "vector": "skinname-vector", - "vector-2022": "skinname-vector-2022" + "skinname-vector": "vector", + "skinname-vector-2022": "vector-2022" } }, "MirahezeReportsBlockAlertKeywords": { From 8a6d0724503f83a2cb6b06a6db671aeee42097da Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 29 Oct 2024 13:26:10 -0600 Subject: [PATCH 162/162] Fix --- includes/HookHandlers/RequestWiki.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/HookHandlers/RequestWiki.php b/includes/HookHandlers/RequestWiki.php index abbf12d77..fb84cf574 100644 --- a/includes/HookHandlers/RequestWiki.php +++ b/includes/HookHandlers/RequestWiki.php @@ -673,15 +673,15 @@ public function onCreateWikiAfterCreationWithExtraData( array $extraData, string private function buildLocalizedOptions( array $options ): array { $localizedOptions = []; - foreach ( $options as $key => $displayName ) { - $localizedMessage = $this->messageLocalizer->msg( $displayName ); + foreach ( $options as $key => $value ) { + $localizedMessage = $this->messageLocalizer->msg( $key ); if ( !$localizedMessage->isDisabled() ) { - $localizedOptions[$key] = $localizedMessage->text(); + $localizedOptions[$localizedMessage->text()] = $value; continue; } - $localizedOptions[$key] = $displayName; + $localizedOptions[$key] = $value; } return $localizedOptions;