Addshore has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/321864

Change subject: WIP Make extension a betafeature
......................................................................

WIP Make extension a betafeature

TODO:
 - Create an images for the betafeature
 - Decide what we want to say on the betafeature page

Bug: T150738
Change-Id: I8da24657804a2093900823da0c21774bf16ae2b6
---
M TwoColConflict.hooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
4 files changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwoColConflict 
refs/changes/64/321864/1

diff --git a/TwoColConflict.hooks.php b/TwoColConflict.hooks.php
index d433d39..2e905de 100644
--- a/TwoColConflict.hooks.php
+++ b/TwoColConflict.hooks.php
@@ -1,4 +1,7 @@
 <?php
+
+use MediaWiki\MediaWikiServices;
+
 /**
  * Hooks for TwoColConflict extension
  *
@@ -8,8 +11,16 @@
  */
 
 class TwoColConflictHooks {
+
        public static function onAlternateEdit( EditPage $editPage ) {
                global $wgHooks;
+
+               if (
+                       class_exists( BetaFeatures::class ) &&
+                       !BetaFeatures::isFeatureEnabled( 
$editPage->getContext()->getUser(), 'twocolconflict' )
+               ) {
+                       return true;
+               }
 
                $key = array_search( 'TwoColConflictHooks::onAlternateEdit', 
$wgHooks );
                unset( $wgHooks[ 'AlternateEdit' ][ $key ] );
@@ -19,4 +30,23 @@
 
                return false;
        }
+
+       public static function getBetaFeaturePreferences( User $user, array 
&$prefs ) {
+               $config = MediaWikiServices::getInstance()->getMainConfig();
+               $extensionAssetsPath = $config->get( 'ExtensionAssetsPath' );
+
+               if ( $config->get( 'TwoColConflictBetaFeature' ) ) {
+                       $prefs['twocolconflict'] = [
+                               'label-message' => 
'twoColConflict-beta-feature-message',
+                               'desc-message' => 
'twoColConflict-beta-feature-description',
+                               'screenshot' => [
+                                       'ltr' => 
"$extensionAssetsPath/TwoColConflict/resources/TwoColConflict-beta-features-ltr.svg",
+                                       'rtl' => 
"$extensionAssetsPath/TwoColConflict/resources/TwoColConflict-beta-features-rtl.svg",
+                               ],
+                               'info-link' => 
'https://www.mediawiki.org/wiki/Extension:TwoColConflict',
+                               'discussion-link' => 
'https://www.mediawiki.org/wiki/Extension_talk:TwoColConflict',
+                       ];
+               }
+       }
+
 }
diff --git a/extension.json b/extension.json
index 4d8d187..0a1d38a 100644
--- a/extension.json
+++ b/extension.json
@@ -14,6 +14,9 @@
                "TwoColConflictPage": "includes/TwoColConflictPage.php"
        },
        "Hooks": {
+               "GetBetaFeaturePreferences": [
+                       "TwoColConflictHooks::getBetaFeaturePreferences"
+               ],
                "AlternateEdit": [
                        "TwoColConflictHooks::onAlternateEdit"
                ]
diff --git a/i18n/en.json b/i18n/en.json
index 77dac1b..4126d95 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -6,6 +6,8 @@
        },
        "twoColConflict": "TwoColConflict",
        "twoColConflict-desc": "Showing a side-by-side edit merge screen for 
edit conflict resolution",
+       "twoColConflict-beta-feature-message": "",
+       "twoColConflict-beta-feature-description": "",
        "twoColConflict-explainconflict": "Another user just edited and saved 
this page. There is a conflict between your version and the current version. 
You will have to merge your changes into the current text version. Only the 
text in the editor field will be saved when you click on \"$1\".",
        "twoColConflict-changes-col-title": "Conflicting changes",
        "twoColConflict-changes-col-desc": "Differences between the currently 
published version (by $1 on $2) and your text ($3)",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 131246e..29c0ab4 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -6,6 +6,8 @@
        },
        "twoColConflict": "TwoColConflict",
        "twoColConflict-desc": 
"{{desc|name=TwoColConflict|url=https://www.mediawiki.org/wiki/Extension:TwoColConflict}}";,
+       "twoColConflict-beta-feature-message": "Label for the TwoColConflict 
Beta Feature.",
+       "twoColConflict-beta-feature-description": "Description for the 
TwoColConflict Beta Feature, describing the feature that will be enabled.",
        "twoColConflict-explainconflict": "Appears at the top of a page when 
there is an edit conflict.\n\nParameters:\n$1 - Label of the save button. 
Either {{msg-mw|savechanges}} or {{msg-mw|publishchanges}}.\n\nSee also:\n* 
{{msg-mw|Savearticle}}",
        "twoColConflict-changes-col-title": "Header for the conflicting changes 
column.",
        "twoColConflict-changes-col-desc": "Description text for the 
conflicting changes column.\n\nParameters:\n$1 - Username of user that edited 
the current revision of the page.\n$2 - User-formatted time and date when the 
current revision was changed.\n$3 - User-formatted time and date of the 
conflicting change.",

-- 
To view, visit https://gerrit.wikimedia.org/r/321864
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8da24657804a2093900823da0c21774bf16ae2b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwoColConflict
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to