jenkins-bot has submitted this change and it was merged.
Change subject: Story 1405: Update messages
......................................................................
Story 1405: Update messages
Overhaul all our messages
In process fix following bugs:
Bug: 54795
Bug: 56437
Change-Id: I827ac7894db534fc3bf3732516117f01f41fda8e
---
M MobileFrontend.i18n.php
M includes/Resources.php
M includes/skins/SkinMinerva.php
M includes/skins/UserAccountCreateMobileTemplate.php
M includes/skins/UserLoginAndCreateTemplate.php
M includes/skins/UserLoginMobileTemplate.php
M javascripts/modules/editor/editor.js
M less/specials/userlogin.less
8 files changed, 140 insertions(+), 43 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
Kaldari: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 73c6621..78f9faf 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -187,9 +187,11 @@
// image donation
'mobile-frontend-donate-image-nouploads' => 'No uploads.',
- 'mobile-frontend-donate-image-login' => 'You must be logged in to see
your uploads.',
+ 'mobile-frontend-donate-image-login' => 'Media on {{SITENAME}} is
donated by people like you.',
+ 'mobile-frontend-donate-image-login-action' => 'Login to share your
media.',
+ 'mobile-frontend-donate-image-signup-action' => 'Sign up to share your
media with the world.',
'mobile-frontend-photo-upload-disabled' => 'No image is needed on this
page.',
- 'mobile-frontend-photo-upload-anon' => 'You need to be logged in to add
an image to this page.',
+ 'mobile-frontend-photo-upload-anon' => 'Please login to add an image to
this page.',
'mobile-frontend-photo-upload-protected' => 'You do not have permission
to add an image to this page.',
'mobile-frontend-photo-upload-unavailable' => 'Your browser does not
support image uploads.',
'mobile-frontend-photo-upload-generic' => 'Contribute an image',
@@ -212,10 +214,23 @@
'mobile-frontend-watchlist-removed' => 'Removed $1 from your watchlist',
'mobile-frontend-watchlist-view' => 'View your watchlist',
'mobile-frontend-watchlist-more' => 'more',
- 'mobile-frontend-watchlist-cta' => 'Please login or sign up to watch
this page.',
+ 'mobile-frontend-watchlist-cta' => 'Keep track of this page and all
changes to it.',
'mobile-frontend-watchlist-cta-button-login' => 'Login',
'mobile-frontend-watchlist-cta-button-signup' => 'Sign up',
- 'mobile-frontend-watch-login' => 'You must be logged in to watch
pages.',
+
+ // login headers from left nav
+ 'mobile-frontend-watchlist-purpose' => 'A watchlist helps you bookmark
pages and keep track of changes to them.',
+ 'mobile-frontend-watchlist-login-action' => 'Login to see it.',
+ 'mobile-frontend-watchlist-signup-action' => 'Sign up to start one
now.',
+ 'mobile-frontend-generic-login' => '{{SITENAME}} is made by people like
you.',
+ 'mobile-frontend-generic-login-action' => 'Login to contribute.',
+ 'mobile-frontend-generic-signup-action' => 'Sign up to contribute.',
+
+ // login article actions
+ 'mobile-frontend-watch-login' => 'Add $1 to your watchlist.',
+ 'mobile-frontend-edit-login' => 'Help improve the $1 page.',
+ 'mobile-frontend-edit-login-action' => 'Login to edit.',
+ 'mobile-frontend-edit-signup-action' => 'Sign up to edit.',
'mobile-frontend-watchlist-a-z' => 'List',
'mobile-frontend-watchlist-feed' => 'Modified',
@@ -285,7 +300,6 @@
'mobile-frontend-photo-cancel' => 'Cancel',
'mobile-frontend-photo-upload-user-count' =>
'{{PLURAL:$1|<span>1</span> upload|<span>$1</span> uploads}}',
'mobile-frontend-photo-upload-user-count-over-limit' => '500+ uploads',
- 'mobile-frontend-photo-upload-login' => 'You must be logged in to add
an image.',
'mobile-frontend-image-heading-describe' => "'''Describe''' image",
'mobile-frontend-image-uploading' => "'''Uploading''' image...",
'mobile-frontend-image-cancel-confirm' => "Cancel upload?",
@@ -293,9 +307,10 @@
// edit
'mobile-frontend-editor-undo-unsupported' => 'Undo is not currently
supported on mobile devices.',
'mobile-frontend-editor-newpage-prompt' => 'This page doesn\'t exist.
Why not be bold and create it?',
- 'mobile-frontend-editor-disabled' => 'You are not allowed to edit this
page.',
+ 'mobile-frontend-editor-disabled' => 'This page is protected to prevent
vandalism.',
+ 'mobile-frontend-editor-blocked' => 'Your account is blocked from
editing.',
'mobile-frontend-editor-unavailable' => 'Mobile editing is not
currently available on your browser. Please try a different browser.',
- 'mobile-frontend-editor-cta' => 'You must be logged in to edit pages on
mobile.',
+ 'mobile-frontend-editor-cta' => 'Help improve this page!',
'mobile-frontend-editor-edit' => 'Edit',
'mobile-frontend-editor-continue' => 'Continue',
'mobile-frontend-editor-save' => 'Save',
@@ -731,6 +746,8 @@
Used when the user is not logged in.
{{Related|Mobile-frontend-login}}',
+ 'mobile-frontend-donate-image-login-action' => 'Call to action to login
to donate images.',
+ 'mobile-frontend-donate-image-signup-action' => 'Call to action to
signup to donate images.',
'mobile-frontend-photo-upload-disabled' => "Appears when the user
clicks on the image upload button when the page doesn't need an image.",
'mobile-frontend-photo-upload-anon' => 'Appears when an anonymous user
clicks on the image upload button and without CTA enabled.',
'mobile-frontend-photo-upload-protected' => 'Appears when the user
clicks the image upload button when the page is protected.',
@@ -769,10 +786,26 @@
{{Identical|Login}}',
'mobile-frontend-watchlist-cta-button-signup' => 'A link with label to
sign up page
{{Identical|Sign up}}',
- 'mobile-frontend-watch-login' => 'Title for [[Special:UserLogin]].
+ // login headers from left nav
+ 'mobile-frontend-watchlist-purpose' => 'Shows on [[Special:UserLogin]]
explains why someone would want to login to see a watchlist.',
+ 'mobile-frontend-watchlist-login-action' => 'Call to action that
follows {{msg-mw|mobile-frontend-watchlist-purpose}} asking them to login.',
+ 'mobile-frontend-watchlist-signup-action' => 'Call to action that
follows {{msg-mw|mobile-frontend-watchlist-purpose}} asking them to signup.',
+ 'mobile-frontend-generic-login' => 'Shows on [[Special:UserLogin]] to
remind them how {{SITENAME}} relies on contributions.',
+ 'mobile-frontend-generic-login-action' => 'Call to action that follows
{{msg-mw|mobile-frontend-generic-login}} asking them to login.',
+ 'mobile-frontend-generic-signup-action' => 'Call to action that follows
{{msg-mw|mobile-frontend-generic-login}} asking them to signup.',
-Used when the user is not logged in.
-{{Related|Mobile-frontend-login}}',
+ // login article actions
+ 'mobile-frontend-watch-login' => 'Shows on [[Special:UserLogin]] when a
user tries to watch a page whilst anonymous.
+
+Parameters:
+$1 - the page that will be watched upon logging in or signing up.
+',
+ 'mobile-frontend-edit-login' => 'Shows on [[Special:UserLogin]] when a
user tries to edit a page whilst anonymous.
+
+Parameters:
+$1 - the page that the user can edit upon logging in or signing up.',
+ 'mobile-frontend-edit-login-action' => 'Call to action that follows
{{msg-mw|mobile-frontend-edit-login}} asking them to login.',
+ 'mobile-frontend-edit-signup-action' => 'Call to action that follows
{{msg-mw|mobile-frontend-edit-login}} asking them to sign up.',
'mobile-frontend-watchlist-a-z' => 'Label for a button that takes you
to an A-Z list of all items in your watchlist.
{{Identical|List}}',
'mobile-frontend-watchlist-feed' => 'Label for a button that takes you
to a list of pages you watch that have changes.
@@ -878,7 +911,8 @@
'mobile-frontend-image-cancel-confirm' => 'A question asking if the
user wants to cancel an upload.',
'mobile-frontend-editor-undo-unsupported' => 'Shown when user attempts
to do an undo which is currently not supported.',
'mobile-frontend-editor-newpage-prompt' => "Message shown when a page
doesn't exist.",
- 'mobile-frontend-editor-disabled' => 'Toast message that appears when a
user is unable to edit a page and clicks edit icon',
+ 'mobile-frontend-editor-disabled' => 'Toast message that appears when a
user is unable to edit a page and clicks edit icon.',
+ 'mobile-frontend-editor-blocked' => 'Toast message that appears when a
user is unable to edit a page due to being blocked and clicks edit icon.',
'mobile-frontend-editor-unavailable' => 'Toast message that appears
when a user has a browser incapable of editing when they click on the edit
button.',
'mobile-frontend-editor-cta' => "Caption for call to action when an
anonymous user clicks on edit icon. (Note the mobile site currently doesn't
allow anonymous editing.)",
'mobile-frontend-editor-edit' => 'Caption for the link showing edit
form.
diff --git a/includes/Resources.php b/includes/Resources.php
index 673e33d..15aad8f 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -757,6 +757,7 @@
// editor.js
'mobile-frontend-editor-disabled',
'mobile-frontend-editor-unavailable',
+ 'mobile-frontend-editor-blocked',
'mobile-frontend-editor-cta',
'mobile-frontend-editor-edit',
// modules/editor/EditorOverlay.js and modules/talk.js
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 27cb38a..0a0eb10 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -553,6 +553,7 @@
$vars['wgWatchedPageCache'] = array(
$title->getPrefixedDBkey() => $user->isWatched(
$title ),
);
+ $vars['wgMFIsUserBlocked'] = $user->isBlocked();
}
// mobile specific config variables
if ( $this->mobileContext->shouldDisplayMobileView() ) {
diff --git a/includes/skins/UserAccountCreateMobileTemplate.php
b/includes/skins/UserAccountCreateMobileTemplate.php
index 1eedca4..0af8382 100644
--- a/includes/skins/UserAccountCreateMobileTemplate.php
+++ b/includes/skins/UserAccountCreateMobileTemplate.php
@@ -3,6 +3,16 @@
* Provides a custom account creation form for mobile devices
*/
class UserAccountCreateMobileTemplate extends UserLoginAndCreateTemplate {
+ protected $actionMessages = array(
+ 'watch' => 'mobile-frontend-watchlist-login',
+ 'edit' => 'mobile-frontend-edit-signup-action',
+ 'signup-edit' => 'mobile-frontend-edit-signup-action',
+ '' => 'mobile-frontend-generic-signup-action',
+ );
+ protected $pageMessages = array(
+ 'Uploads' => 'mobile-frontend-donate-image-signup-action',
+ 'Watchlist' => 'mobile-frontend-watchlist-signup-action',
+ );
/**
* @TODO refactor this into parent template
@@ -18,14 +28,6 @@
$msgBox = ''; // placeholder for displaying any login-related
system messages (eg errors)
// handle captcha
$captcha = $this->handleCaptcha( $this->data['header'] );
- $headMsg = $this->getHeadMsg();
-
- $accountCreation = Html::openElement( 'div', array( 'id' =>
'mw-mf-accountcreate', 'class' => 'content' ) );
-
- // @TODO refactor this into base class
- if ( $headMsg ) {
- $msgBox .= Html::Element( 'div', array( 'class' =>
'headmsg' ), $headMsg );
- }
if ( $message ) {
$heading = '';
@@ -90,9 +92,10 @@
Html::input( 'watch', $watchArticle, 'hidden' ) .
$stickHTTPS .
Html::closeElement( 'form' );
- $accountCreation .= $msgBox . $form;
- $accountCreation .= Html::closeElement( 'div' );
- echo $accountCreation;
+ echo Html::openElement( 'div', array( 'id' =>
'mw-mf-accountcreate', 'class' => 'content' ) );
+ $this->renderGuiderMessage();
+ echo $form;
+ echo Html::closeElement( 'div' );
}
/**
diff --git a/includes/skins/UserLoginAndCreateTemplate.php
b/includes/skins/UserLoginAndCreateTemplate.php
index eacbbd5..7b85ccd 100644
--- a/includes/skins/UserLoginAndCreateTemplate.php
+++ b/includes/skins/UserLoginAndCreateTemplate.php
@@ -8,6 +8,20 @@
* special mobile-specific magic.
*/
abstract class UserLoginAndCreateTemplate extends QuickTemplate {
+ protected $pageMessageHeaders = array(
+ 'Uploads' => 'mobile-frontend-donate-image-login',
+ 'Watchlist' => 'mobile-frontend-watchlist-purpose',
+ );
+ protected $pageMessages = array();
+
+ protected $actionMessageHeaders = array(
+ 'watch' => 'mobile-frontend-watchlist-purpose',
+ 'edit' => 'mobile-frontend-edit-login',
+ 'signup-edit' => 'mobile-frontend-edit-login',
+ '' => 'mobile-frontend-generic-login',
+ );
+
+ protected $actionMessages = array();
/**
* Overload the parent constructor
@@ -70,24 +84,57 @@
return false;
}
- protected function getHeadMsg() {
+ /**
+ * Gets the message that should guide a user who is creating an account
or logging in to an account.
+ * @return Array: first element is header of message and second is the
content.
+ */
+ protected function getGuiderMessage() {
$req = $this->getRequestContext()->getRequest();
if ( $req->getVal( 'returnto' ) && ( $title =
Title::newFromText( $req->getVal( 'returnto' ) ) ) ) {
list( $returnto, /* $subpage */ ) =
SpecialPageFactory::resolveAlias( $title->getDBkey() );
+ $title = $title->getText();
} else {
$returnto = '';
+ $title = '';
}
- $returntoQuery = $req->getVal( 'returntoquery' );
- if ( $returnto == 'Uploads' ) {
- $key = 'mobile-frontend-donate-image-login';
- } elseif ( $returnto == 'Watchlist' || strstr( $returntoQuery,
'article_action=watch' ) ) {
- $key = 'mobile-frontend-watch-login';
- } elseif ( strstr( $returntoQuery,
'article_action=photo-upload' ) ) {
- $key = 'mobile-frontend-photo-upload-login';
+ $returnToQuery = wfCgiToArray( $req->getVal( 'returntoquery' )
);
+ if ( isset( $returnToQuery['article_action'] ) ) {
+ $action = $returnToQuery['article_action'];
} else {
- return '';
+ $action = '';
}
- return wfMessage( $key )->plain();
+
+ $heading = '';
+ $content = '';
+
+ if ( isset( $this->pageMessageHeaders[$returnto] ) ) {
+ $heading = wfMessage(
$this->pageMessageHeaders[$returnto] )->parse();
+ if ( isset( $this->pageMessages[$returnto] ) ) {
+ $content = wfMessage(
$this->pageMessages[$returnto] )->parse();
+ }
+ } else if ( isset( $this->actionMessageHeaders[$action] ) ) {
+ $heading = wfMessage(
$this->actionMessageHeaders[$action], $title )->parse();
+ if ( isset( $this->actionMessages[$action] ) ) {
+ $content = wfMessage(
$this->actionMessages[$action], $title )->parse();
+ }
+ }
+ return array( $heading, $content );
+ }
+
+ /**
+ * Renders a prompt above the login or upload screen
+ *
+ */
+ protected function renderGuiderMessage() {
+ $msgs = $this->getGuiderMessage();
+ if ( $msgs[0] ) {
+ echo Html::openElement( 'div', array( 'class' =>
'headmsg' ) );
+ echo Html::element( 'strong', array(), $msgs[0] );
+ if ( $msgs[1] ) {
+ echo Html::element( 'div', array(), $msgs[1] );
+ }
+ echo Html::closeElement( 'div' );
+ }
}
protected function getLogoHtml() {
diff --git a/includes/skins/UserLoginMobileTemplate.php
b/includes/skins/UserLoginMobileTemplate.php
index 3d792e2..b3c28df 100644
--- a/includes/skins/UserLoginMobileTemplate.php
+++ b/includes/skins/UserLoginMobileTemplate.php
@@ -3,6 +3,15 @@
* Provides a custom login form for mobile devices
*/
class UserLoginMobileTemplate extends UserLoginAndCreateTemplate {
+ protected $actionMessages = array(
+ 'watch' => 'mobile-frontend-watchlist-purpose',
+ 'edit' => 'mobile-frontend-edit-login-action',
+ '' => 'mobile-frontend-generic-login-action',
+ );
+ protected $pageMessages = array(
+ 'Uploads' => 'mobile-frontend-donate-image-login-action',
+ 'Watchlist' => 'mobile-frontend-watchlist-login-action',
+ );
/**
* @TODO refactor this into parent template
@@ -16,7 +25,6 @@
$message = $this->data['message'];
$messageType = $this->data['messagetype'];
$msgBox = ''; // placeholder for displaying any login-related
system messages (eg errors)
- $headMsg = $this->getHeadMsg();
// @TODO make sure this also includes returnto and
returntoquery from the request
$query = array(
@@ -45,10 +53,6 @@
array( 'class'=> 'mw-mf-create-account' ), $query );
$login = Html::openElement( 'div', array( 'id' =>
'mw-mf-login', 'class' => 'content' ) );
-
- if ( $headMsg ) {
- $msgBox .= Html::Element( 'div', array( 'class' =>
'headmsg' ), $headMsg );
- }
if ( $message ) {
$heading = '';
@@ -99,9 +103,11 @@
$stickHTTPS .
Html::closeElement( 'form' ) .
Html::closeElement( 'div' );
- $login .= $msgBox . $form;
- $login .= Html::closeElement( 'div' );
echo $login;
+ $this->renderGuiderMessage();
+ echo $msgBox;
+ echo $form;
+ echo Html::closeElement( 'div' );
}
}
diff --git a/javascripts/modules/editor/editor.js
b/javascripts/modules/editor/editor.js
index 7eb2fc2..8a198a9 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -4,6 +4,7 @@
inStable = mw.config.get( 'wgMFMode' ) === 'stable',
user = M.require( 'user' ),
popup = M.require( 'notifications' ),
+ isUserBlocked = mw.config.get( 'wgMFIsUserBlocked' ),
// FIXME: Disable on IE < 10 for time being
blacklisted = /MSIE \d\./.test( navigator.userAgent ),
isEditingSupported = M.router.isSupported() && !blacklisted,
@@ -12,7 +13,8 @@
CtaDrawer = M.require( 'CtaDrawer' ),
drawer = new CtaDrawer( {
queryParams: {
- campaign: 'mobile_editPageActionCta'
+ campaign: 'mobile_editPageActionCta',
+ returntoquery: 'article_action=edit'
},
signupQueryParams: { returntoquery:
'article_action=signup-edit' },
content: mw.msg( 'mobile-frontend-editor-cta' )
@@ -113,7 +115,7 @@
} );
}
- if ( mw.config.get( 'wgIsPageEditable' ) && isEditingSupported ) {
+ if ( mw.config.get( 'wgIsPageEditable' ) && isEditingSupported &&
!isUserBlocked ) {
if ( mw.config.get( 'wgMFAnonymousEditing' ) || user.getName()
) {
init();
M.on( 'page-loaded', init );
@@ -124,7 +126,11 @@
} else {
// FIXME change when micro.tap.js in stable
$( '#ca-edit, .edit-page' ).on( M.tapEvent( 'click' ),
function( ev ) {
- popup.show( mw.msg( isEditingSupported ?
'mobile-frontend-editor-disabled' : 'mobile-frontend-editor-unavailable' ),
'toast' );
+ var msg = 'mobile-frontend-editor-blocked';
+ if ( !isUserBlocked ) {
+ msg = isEditingSupported ?
'mobile-frontend-editor-disabled' : 'mobile-frontend-editor-unavailable';
+ }
+ popup.show( mw.msg( msg ), 'toast' );
ev.preventDefault();
} );
}
diff --git a/less/specials/userlogin.less b/less/specials/userlogin.less
index 786a8f8..9ef6724 100644
--- a/less/specials/userlogin.less
+++ b/less/specials/userlogin.less
@@ -22,7 +22,6 @@
background-color: #eee;
border: 1px solid #ccc;
color: #252525;
- font-weight: bold;
padding: 0.5em 1em;
margin: 1em 0;
}
--
To view, visit https://gerrit.wikimedia.org/r/99777
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I827ac7894db534fc3bf3732516117f01f41fda8e
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits