jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350553 )

Change subject: Rc Filters beta feature invitation tour
......................................................................


Rc Filters beta feature invitation tour

Guided tour to invite users to enable
the RC filters beta feature.

Bug: T144457
Change-Id: I7768f2dd1132881baeb7b0f546d610f68a2ba44b
---
M WikimediaMessages.hooks.php
M i18n/wikimedia/en.json
M i18n/wikimedia/qqq.json
A modules/images/feedback-blue-ltr.svg
A modules/rcfilters-invite-tour.js
A modules/rcfilters-invite-tour.less
6 files changed, 184 insertions(+), 9 deletions(-)

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



diff --git a/WikimediaMessages.hooks.php b/WikimediaMessages.hooks.php
index c778ad3..3b7e1d9 100644
--- a/WikimediaMessages.hooks.php
+++ b/WikimediaMessages.hooks.php
@@ -1342,18 +1342,24 @@
 
                if (
                        $title->isSpecial( 'Recentchanges' ) &&
-                       $user->isLoggedIn() &&
-                       !!$user->getOption( 'rcenhancedfilters' )
+                       $user->isLoggedIn()
                ) {
-                       if ( !$user->getOption( 'rcenhancedfilters-seen-tour' ) 
) {
-                               GuidedTourLauncher::launchTourByCookie( 
'RcFiltersBeta', 'Welcome' );
-                               $out->addJsConfigVars( 
'wgRCFiltersORESAvailable', self::isOresAvailable() );
-                       }
+                       if ( $user->getOption( 'rcenhancedfilters' ) ) {
+                               if ( !$user->getOption( 
'rcenhancedfilters-seen-tour' ) ) {
+                                       GuidedTourLauncher::launchTourByCookie( 
'RcFiltersBeta', 'Welcome' );
+                                       $out->addJsConfigVars( 
'wgRCFiltersORESAvailable', self::isOresAvailable() );
+                               }
 
-                       if ( !$user->getOption( 
'rcenhancedfilters-tried-highlight' ) ) {
-                               $out->addModules( 
'ext.guidedTour.tour.RcFiltersHighlight' );
-                       }
+                               if ( !$user->getOption( 
'rcenhancedfilters-tried-highlight' ) ) {
+                                       $out->addModules( 
'ext.guidedTour.tour.RcFiltersHighlight' );
+                               }
 
+                               if ( $user->getOption( 
'rcenhancedfilters-show-invite-confirmation' ) ) {
+                                       GuidedTourLauncher::launchTourByCookie( 
'RcFiltersInvite', 'Confirm' );
+                               }
+                       } elseif ( !$user->getOption( 
'rcenhancedfilters-seen-invite' ) ) {
+                               GuidedTourLauncher::launchTourByCookie( 
'RcFiltersInvite', 'Invite' );
+                       }
                }
        }
 
@@ -1393,6 +1399,28 @@
                                        'ext.guidedTour'
                                ],
                        ] );
+
+                       $resourceLoader->register( 
'ext.guidedTour.tour.RcFiltersInvite', [
+                               'localBasePath' => __DIR__ . '/modules',
+                               'remoteExtPath' => 'WikimediaMessages/modules',
+                               'scripts' => [
+                                       'rcfilters-invite-tour.js',
+                               ],
+                               'styles' => 'rcfilters-invite-tour.less',
+                               'messages' => [
+                                       'eri-rcfilters-tour-invite-title',
+                                       'eri-rcfilters-tour-invite-description',
+                                       
'eri-rcfilters-tour-invite-learnmore-link-label',
+                                       'eri-rcfilters-tour-invite-yes-button',
+                                       'eri-rcfilters-tour-invite-no-button',
+                                       'eri-rcfilters-tour-confirm-title',
+                                       
'eri-rcfilters-tour-confirm-description',
+                               ],
+                               'dependencies' => [
+                                       'ext.guidedTour'
+                               ],
+                       ] );
+
                }
 
                return true;
@@ -1414,10 +1442,18 @@
                        'type' => 'api',
                ];
 
+               $preferences[ 'rcenhancedfilters-seen-invite' ] = [
+                       'type' => 'api',
+               ];
+
                $preferences[ 'rcenhancedfilters-seen-highlight-button-counter' 
] = [
                        'type' => 'api',
                ];
 
+               $preferences[ 'rcenhancedfilters-show-invite-confirmation' ] = [
+                       'type' => 'api',
+               ];
+
                return true;
        }
 }
diff --git a/i18n/wikimedia/en.json b/i18n/wikimedia/en.json
index ec50ef0..b20ed80 100644
--- a/i18n/wikimedia/en.json
+++ b/i18n/wikimedia/en.json
@@ -282,6 +282,13 @@
        "eri-rcfilters-tour-highlight-title": "Color code your results",
        "eri-rcfilters-tour-highlight-description": "Use highlighting to 
visually distinguish selected properties.<br/><br/>You can combine highlights 
with filters or use highlighting independently.",
        "eri-rcfilters-tour-highlight-button": "OK, got it",
+       "eri-rcfilters-tour-invite-title": "New beta feature available for this 
page",
+       "eri-rcfilters-tour-invite-description": "Try the \"'''New filters for 
edit review.'''\" Find the most relevant edits for your review needs",
+       "eri-rcfilters-tour-invite-learnmore-link-label": "Learn more",
+       "eri-rcfilters-tour-invite-yes-button": "Enable the new filters",
+       "eri-rcfilters-tour-invite-no-button": "No, thanks",
+       "eri-rcfilters-tour-confirm-title": "The new filters are enabled now",
+       "eri-rcfilters-tour-confirm-description": "You can access the 
<strong>beta features page</strong> to provide feedback or disable the 
feature.",
        "wikimedia-ipb-confirmhideuser": "You are about to block a user with 
\"hide user\" enabled. This will suppress the user's name in all lists and log 
entries on this wiki. Are you sure you want to do that?\n\nIf the username 
needs to be hidden on all Wikimedia wikis, please contact 
[[m:Special:MyLanguage/Stewards|stewards]] at [email protected].",
        "wikimedia-feedback-termsofuse": "I agree to provide feedback in 
accordance with the <a 
href=\"https://wikimediafoundation.org/wiki/Terms_of_Use\"; 
target=\"_blank\">Terms of Use</a>.",
        "wikimedia-globalrenamequeue-email-body-approved": "The request to 
rename \"{{GENDER:$1|$1}}\" to \"{{GENDER:$1|$2}}\" has been approved. Once 
completed, you will be able to log in using your new username with your old 
password. Thank you for participating on Wikimedia projects.",
diff --git a/i18n/wikimedia/qqq.json b/i18n/wikimedia/qqq.json
index c39b5f6..e0b56b3 100644
--- a/i18n/wikimedia/qqq.json
+++ b/i18n/wikimedia/qqq.json
@@ -311,6 +311,13 @@
        "eri-rcfilters-tour-highlight-title": "Title of the first step of the 
guided tour introducing the RC filters highlight feature.",
        "eri-rcfilters-tour-highlight-description": "Description of the first 
step of the guided tour introducing the RC filters highlight feature.",
        "eri-rcfilters-tour-highlight-button": "Text of the button to close the 
RC filters highlight feature guided tour.",
+       "eri-rcfilters-tour-invite-title": "Title of the first step of the 
guided tour inviting users to try the RC Filters beta feature.",
+       "eri-rcfilters-tour-invite-description": "Main text of the first step 
of the guided tour inviting users to try the RC Filters beta feature.",
+       "eri-rcfilters-tour-invite-learnmore-link-label": "Label of the link to 
learn more about the RC Filters beta feature on the guided tour.",
+       "eri-rcfilters-tour-invite-yes-button": "Text of the button to enable 
the RC Filters beta feature from the guided tour.",
+       "eri-rcfilters-tour-invite-no-button": "Text of the button to dismiss 
the guided tour about the RC Filters beta feature.",
+       "eri-rcfilters-tour-confirm-title": "Title of the confirmation step 
after the user has agreed to enable the RC Filters beta feature from the guided 
tour.",
+       "eri-rcfilters-tour-confirm-description": "Main text of the 
confirmation step after the user has agreed to enable the RC Filters beta 
feature from the guided tour.",
        "wikimedia-ipb-confirmhideuser": "Used as confirmation message in 
[[Special:Block]] before doing a HideUser block.\n\nSee also:\n* 
{{msg-mw|Ipb-blockingself}} and {{msg-mw|ipb-confirmhideuser}}",
        "wikimedia-feedback-termsofuse": "Label for agreeing to the Wikimedia 
terms of use with a link to the official terms of use page.",
        "wikimedia-globalrenamequeue-email-body-approved": "Email body for 
approved request.\n\n* $1 is the old username\n* $2 is the new username.",
diff --git a/modules/images/feedback-blue-ltr.svg 
b/modules/images/feedback-blue-ltr.svg
new file mode 100644
index 0000000..75a19fd
--- /dev/null
+++ b/modules/images/feedback-blue-ltr.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="42" height="42" viewBox="0 0 42 
42">
+    <path d="M11.505 30.086l1.42 5.252c.495 1.913 2.65 3.05 4.5 2.54 
1.745-.482 2.812-2.457 2.315-4.367l-.95-3.425H41L34.072 3 1.387 22.13c-1.067 
1.906.22 6.87 2.058 7.956h8.06z" fill="#36c"/>
+</svg>
diff --git a/modules/rcfilters-invite-tour.js b/modules/rcfilters-invite-tour.js
new file mode 100644
index 0000000..aa8f5ed
--- /dev/null
+++ b/modules/rcfilters-invite-tour.js
@@ -0,0 +1,71 @@
+/*!
+ * Guided tour for inviting users to try the rcfilters beta feature
+ */
+( function ( mw, gt ) {
+       var tour = new gt.TourBuilder( {
+                       name: 'RcFiltersInvite',
+                       shouldLog: true,
+                       isSinglePage: true
+               } ),
+               descText = mw.message( 'eri-rcfilters-tour-invite-description' 
).text(),
+               url = 
'https://www.mediawiki.org/wiki/Special:MyLanguage/Edit_Review_Improvements/New_filters_for_edit_review',
+               linkLabel = mw.message( 
'eri-rcfilters-tour-invite-learnmore-link-label' ).text(),
+               inviteDesc = new gt.WikitextDescription(
+                       descText + '<br />' + '[' + url + ' ' + linkLabel + ']'
+               ),
+               $attachTo = $( '#pt-betafeatures > a' );
+
+       if ( $attachTo.length === 0 ) {
+               $attachTo = $( '#pt-preferences > a' );
+       }
+
+       tour.firstStep( {
+               name: 'Invite',
+               titlemsg: 'eri-rcfilters-tour-invite-title',
+               description: inviteDesc,
+               autoFocus: true,
+               allowAutomaticOkay: false,
+               attachTo: $attachTo,
+               position: 'bottom',
+               onShow: function () {
+                       var api = new mw.Api();
+                       api.saveOption( 'rcenhancedfilters-seen-invite', 1 );
+               },
+               buttons: [
+                       {
+                               namemsg: 'eri-rcfilters-tour-invite-no-button',
+                               type: 'quiet',
+                               onclick: function () {
+                                       gt.endTour();
+                               }
+                       },
+                       {
+                               namemsg: 'eri-rcfilters-tour-invite-yes-button',
+                               onclick: function () {
+                                       var api = new mw.Api();
+                                       api.saveOptions( {
+                                               'rcenhancedfilters': 1, // 
enable the beta feature
+                                               'rcenhancedfilters-seen-tour': 
1, // cancel the other 'welcome' tour
+                                               
'rcenhancedfilters-show-invite-confirmation': 1 // show 'Confirm' step
+                                       } ).then( function () {
+                                               location.reload( true );
+                                       } );
+                               }
+                       }
+               ]
+       } );
+
+       tour.step( {
+               name: 'Confirm',
+               titlemsg: 'eri-rcfilters-tour-confirm-title',
+               descriptionmsg: 'eri-rcfilters-tour-confirm-description',
+               attachTo: $attachTo,
+               position: 'bottom',
+               onShow: function () {
+                       var api = new mw.Api();
+                       api.saveOption( 
'rcenhancedfilters-show-invite-confirmation', 0 );
+
+                       setTimeout( gt.endTour, 5000 );
+               }
+       } );
+}( mediaWiki, mediaWiki.guidedTour ) );
diff --git a/modules/rcfilters-invite-tour.less 
b/modules/rcfilters-invite-tour.less
new file mode 100644
index 0000000..71377ea
--- /dev/null
+++ b/modules/rcfilters-invite-tour.less
@@ -0,0 +1,50 @@
+.mw-guidedtour-tour-RcFiltersInvite {
+       padding: 40px;
+
+       .guider_content {
+               background-position-x: 50%;
+               background-repeat: no-repeat;
+
+               .guider_close {
+                       display: none;
+               }
+
+               .guider_description {
+                       font-size: 1.2em;
+                       color: #808080;
+
+                       p {
+                               color: #808080;
+                       }
+               }
+       }
+
+       // first step (Invite)
+       &#gt-RcFiltersInvite-Invite {
+               width: 290px !important;
+               height: 405px !important;
+               .guider_content {
+                       /* @embed */
+                       background-image: url( 
images/rc-beta-tour-welcome-ltr.gif );
+                       // Make space for the image
+                       padding-top: 200px;
+               }
+       }
+
+       // second step (Confirm)
+       &#gt-RcFiltersInvite-Confirm {
+               width: 290px !important;
+               height: 190px !important;
+               .guider_content {
+                       /* @embed */
+                       background-image: url( images/feedback-blue-ltr.svg );
+                       // Make space for the image
+                       padding-top: 70px;
+
+                       .guider_buttons {
+                               display: none;
+                       }
+               }
+       }
+
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7768f2dd1132881baeb7b0f546d610f68a2ba44b
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/WikimediaMessages
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Sbisson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to