jenkins-bot has submitted this change and it was merged.

Change subject: Add cross-wiki as a beta feature
......................................................................


Add cross-wiki as a beta feature

This commit only adds the beta feature parameters and preference.
The API will need to check whether the feature is enabled.

The beta feature option is behind a feature flag
$wgEchoUseCrossWikiBetaFeature, that must be set to true for
the beta feature to appear on the wiki.

Bug: T114237
Change-Id: I61e1bd62571e55f7f685f64e0c37e7702875e407
---
M Echo.php
M Hooks.php
M i18n/en.json
M i18n/qqq.json
A images/betafeatures-icon-notifications-ltr.svg
A images/betafeatures-icon-notifications-rtl.svg
6 files changed, 90 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Echo.php b/Echo.php
index fe5a3ae..9ecdaa1 100644
--- a/Echo.php
+++ b/Echo.php
@@ -106,6 +106,9 @@
 $wgHooks['GetNewMessagesAlert'][] = 'EchoHooks::abortNewMessagesAlert';
 $wgHooks['LinksUpdateAfterInsert'][] = 'EchoHooks::onLinksUpdateAfterInsert';
 
+// Beta features
+$wgHooks['GetBetaFeaturePreferences'][] = 
'EchoHooks::getBetaFeaturePreferences';
+
 // Configuration
 
 // Whether to turn on email batch function
@@ -197,6 +200,9 @@
 // sprintf format of per-user notification agent whitelists. Set to null to 
disable.
 $wgEchoPerUserWhitelistFormat = '%s/Echo-whitelist';
 
+// Feature flag for the cross-wiki notifications beta feature
+$wgEchoUseCrossWikiBetaFeature = false;
+
 // Define the categories that notifications can belong to. Categories can be
 // assigned the following parameters: priority, nodismiss, tooltip, and 
usergroups.
 // All parameters are optional.
diff --git a/Hooks.php b/Hooks.php
index 00e4842..e1900ac 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -205,6 +205,36 @@
        }
 
        /**
+        * Handler for the GetBetaFeaturePreferences hook.
+        * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/GetBetaFeaturePreferences
+        *
+        * @param $user User to get preferences for
+        * @param &$preferences Preferences array
+        *
+        * @return bool true in all cases
+        */
+       public static function getBetaFeaturePreferences( User $user, array 
&$preferences ) {
+               global $wgExtensionAssetsPath, $wgEchoUseCrossWikiBetaFeature;
+
+               if ( $wgEchoUseCrossWikiBetaFeature ) {
+                       $preferences['echo-cross-wiki-notifications'] = array(
+                               'label-message' => 
'echo-pref-beta-feature-cross-wiki-message',
+                               'desc-message' => 
'echo-pref-beta-feature-cross-wiki-description',
+                               // Paths to images that represents the feature.
+                               'screenshot' => array(
+                                       'rtl' => 
"$wgExtensionAssetsPath/Echo/images/betafeatures-icon-notifications-rtl.svg",
+                                       'ltr' => 
"$wgExtensionAssetsPath/Echo/images/betafeatures-icon-notifications-ltr.svg",
+                               ),
+                               'info-link' => 
'https://www.mediawiki.org/wiki/Extension:Echo',
+                               // Link to discussion about the feature - talk 
pages might work
+                               'discussion-link' => 
'https://www.mediawiki.org/wiki/Extension_talk:Echo',
+                       );
+               }
+
+               return true;
+       }
+
+       /**
         * Handler for GetPreferences hook.
         * @see http://www.mediawiki.org/wiki/Manual:Hooks/GetPreferences
         *
diff --git a/i18n/en.json b/i18n/en.json
index 14ae53e..0a313af 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -22,6 +22,8 @@
        "echo-pref-email-format-html": "HTML",
        "echo-pref-email-format-plain-text": "Plain text",
        "echo-pref-new-message-indicator": "Show talk page message indicator in 
my toolbar",
+       "echo-pref-beta-feature-cross-wiki-message": "Enhanced notifications",
+       "echo-pref-beta-feature-cross-wiki-description": "View and organize 
notifications more easily. Includes cross-wiki notifications, which lets you 
see messages from other wikis.",
        "echo-learn-more": "Learn more",
        "echo-new-messages": "You have new messages",
        "echo-category-title-edit-user-talk": "Talk page 
{{PLURAL:$1|message|messages}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 89cf271..5a31786 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -43,6 +43,8 @@
        "echo-pref-email-format-html": "Option for users who want to receive 
HTML email notification.\n\nSee also:\n* 
{{msg-mw|Echo-pref-email-format}}\n{{Identical|HTML}}",
        "echo-pref-email-format-plain-text": "Option for users who want to 
receive plain text email notification.\n\nSee also:\n* 
{{msg-mw|Echo-pref-email-format}}\n{{Identical|Plain text}}",
        "echo-pref-new-message-indicator": "Label for a preference which 
enables the new talk page message alert",
+       "echo-pref-beta-feature-cross-wiki-message": "Label for the cross-wiki 
notifications Beta Feature.",
+       "echo-pref-beta-feature-cross-wiki-description": "Description for the 
cross-wiki notifications Beta Feature, describing the feature that will be 
enabled.",
        "echo-learn-more": "Text for link to more information about a 
topic.\n{{Identical|Learn more}}",
        "echo-new-messages": "Message to let the user know that they have new 
talk page messages, displayed in the personal menu (top-right corner on Vector 
and Monobook).\n\nKeep this message short. It '''should not''' end in a full 
stop.",
        "echo-category-title-edit-user-talk": "This is a short title for 
notification category.\n\nUsed in a list of options under the heading 
{{msg-mw|Prefs-echosubscriptions}} in Special:Preferences. As far as I can see 
this always needs to be a plural for an unspecified number.\n\nIt used to be 
used as <code>$1</code> in {{msg-mw|Echo-dismiss-message}}, but this message is 
no longer used, apparently.\n\nParameters:\n* $1 - number of messages, for 
PLURAL support\n{{Related|Echo-category-title}}",
diff --git a/images/betafeatures-icon-notifications-ltr.svg 
b/images/betafeatures-icon-notifications-ltr.svg
new file mode 100644
index 0000000..3d949c8
--- /dev/null
+++ b/images/betafeatures-icon-notifications-ltr.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="264" height="162" viewBox="0 0 
264 162">
+    <g>
+        <path d="M13.366 161.357L.5 151.75V.5h263v151.75l-9 
6.704V42.5h-39v112.6l-4.393-3.73-7.607 5.33V42.5h-155v110.85l-9.75 
8.03-13.917-10.02z" fill="#fff"/>
+        <path d="M263 1v150.998l-8 
5.96V42h-40v112.02l-3.274-2.78-.59-.5-.632.442-6.504 4.556V42H48v111.1l-9.257 
7.66-13.295-9.57-.645-.463-.598.52-10.864 9.47L1 151.5V1h262m1-1H0v152l13.39 10 
11.475-10 13.89 10L49 153.6V43h154v114.66l8.078-5.66 4.922 
4.18V43h38v116.95l10-7.45V0z" fill="#e5e5e5"/>
+    </g>
+    <path d="M203 157.66V43H49v110.6l2.145-1.6L63.7 162l13.81-10 14.228 10 
12.972-10 12.973 10 13.81-10 12.137 10 13.39-10 14.23 10 12.972-10 12.974 10 
5.804-4.34z" fill="#e5e5e5"/>
+    <path d="M11 36c0-7.732 6.268-14 14-14s14 6.268 14 14-6.268 14-14 
14-14-6.268-14-14z" fill="#e5e5e5"/>
+    <path d="M254 159.95V43h-38v113.18l7.55 5.82 13.812-10 13.89 10 
2.748-2.05z" fill="#e5e5e5"/>
+    <path d="M38 132.354V72H13v60.354h25z" fill="#e5e5e5"/>
+    <path d="M232.51 5h26v6h-26V5z" fill="#e5e5e5"/>
+    <path d="M208.51 5h22v6h-22z" fill="#e5e5e5"/>
+    <path d="M142 6v4H50V6h92m1-1H49v6h94V5z" fill="#e5e5e5"/>
+    <path d="M184.51 5h22v6h-22z" fill="#e5e5e5"/>
+    <path d="M161.51 5h13v6h-13z" fill="#e5e5e5"/>
+    <path d="M176.51 5h6v6h-6z" fill="#347bff"/>
+    <path d="M153.51 5h6v6h-6z" fill="#e5e5e5"/>
+    <path d="M9 5h32v6H9z" fill="#e5e5e5"/>
+    <path d="M2 14.5h260" fill="#e5e5e5" stroke="#e5e5e5"/>
+    <path d="M52 7h2v2h-2z" fill="#e5e5e5"/>
+    <path d="M38 59v-5H13v5h25z" fill="#e5e5e5"/>
+    <rect width="78.835" height="93.208" rx=".106" ry=".099" x="140.303" 
y="18.566" fill="#347bff"/>
+    <path d="M179.72 44.254c-7.436 0-12.782 4.648-12.782 11.62v11.62c0 4.648 0 
6.972-4.648 6.972v2.324h34.86v-2.324c-4.648 
0-4.648-2.324-4.648-6.972v-11.62c0-6.972-5.345-11.62-12.782-11.62zm-6.972 
37.184c0 2.324 3.72 4.648 6.972 4.648 3.254 0 6.972-2.324 6.972-4.648h-13.944z" 
fill="#fff"/>
+    <path d="M175.183 19l4.537-6 4.537 6" fill="#347bff"/>
+</svg>
diff --git a/images/betafeatures-icon-notifications-rtl.svg 
b/images/betafeatures-icon-notifications-rtl.svg
new file mode 100644
index 0000000..2755788
--- /dev/null
+++ b/images/betafeatures-icon-notifications-rtl.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="264" height="162" viewBox="0 0 
264 162" id="svg2">
+    <g id="g4">
+        <path d="M250.634 161.357l12.866-9.608V.5H.5v151.75l9 
6.704V42.5h39v112.6l4.393-3.73 7.607 5.33V42.5h155v110.85l9.75 8.03 
13.917-10.02z" fill="#fff"/>
+        <path d="M1 1v150.998l8 5.96V42h40v112.02l3.274-2.78.59-.5.632.442L60 
155.738V42h156v111.1l9.257 7.66 13.295-9.57.645-.463.598.52 10.864 9.47L263 
151.5V1H1M0 0h264v152l-13.39 10-11.475-10-13.89 10L215 
153.6V43H61v114.66L52.922 152 48 156.18V43H10v116.95L0 152.5V0z" 
fill="#e5e5e5"/>
+    </g>
+    <path d="M61 157.66V43h154v110.6l-2.145-1.6-12.555 10-13.81-10-14.228 
10-12.972-10-12.973 10-13.81-10-12.137 10-13.39-10-14.23 10-12.972-10-12.974 
10L61 157.66z" fill="#e5e5e5"/>
+    <path d="M253 36c0-7.732-6.268-14-14-14s-14 6.268-14 14 6.268 14 14 14 
14-6.268 14-14z" fill="#e5e5e5"/>
+    <path d="M10 159.95V43h38v113.18L40.45 162l-13.812-10-13.89 10L10 159.95z" 
fill="#e5e5e5"/>
+    <path d="M226 132.354V72h25v60.354h-25z" fill="#e5e5e5"/>
+    <path d="M31.49 5h-26v6h26V5z" fill="#e5e5e5"/>
+    <path d="M55.49 5h-22v6h22z" fill="#e5e5e5"/>
+    <path d="M122 6v4h92V6h-92m-1-1h94v6h-94V5z" fill="#e5e5e5"/>
+    <path d="M79.49 5h-22v6h22z" fill="#e5e5e5"/>
+    <path d="M102.49 5h-13v6h13z" fill="#e5e5e5"/>
+    <path d="M87.49 5h-6v6h6z" fill="#347bff"/>
+    <path d="M110.49 5h-6v6h6z" fill="#e5e5e5"/>
+    <path d="M255 5h-32v6h32z" fill="#e5e5e5"/>
+    <path d="M262 14.5H2" fill="#e5e5e5" stroke="#e5e5e5"/>
+    <path d="M212 7h-2v2h2z" fill="#e5e5e5"/>
+    <path d="M226 59v-5h25v5h-25z" fill="#e5e5e5"/>
+    <rect width="78.835" height="93.208" rx=".106" ry=".099" x="-123.697" 
y="18.566" transform="scale(-1 1)" fill="#347bff"/>
+    <path d="M84.28 44.254c7.436 0 12.782 4.648 12.782 11.62v11.62c0 4.648 0 
6.972 4.648 6.972v2.324H66.85v-2.324c4.648 0 4.648-2.324 
4.648-6.972v-11.62c0-6.972 5.345-11.62 12.782-11.62zm6.972 37.184c0 2.324-3.72 
4.648-6.972 4.648-3.254 0-6.972-2.324-6.972-4.648h13.944z" fill="#fff"/>
+    <path d="M88.817 19l-4.537-6-4.537 6" fill="#347bff"/>
+</svg>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I61e1bd62571e55f7f685f64e0c37e7702875e407
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Sbisson <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to