Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/96163
Change subject: Style errors on profile better
......................................................................
Style errors on profile better
Do what Special:MobileDiff does and 404 on no argument
Style like Special:Nearby for errors
Tweak language
Bug: 57087
Change-Id: Icfcf2c9ac4d58fc8bacbe4617b024a255a5469b4
---
M MobileFrontend.i18n.php
M includes/specials/SpecialUserProfile.php
M less/specials/common.less
3 files changed, 18 insertions(+), 27 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/63/96163/1
diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 5eac62a..4b85a15 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -338,10 +338,10 @@
'mobile-frontend-profile-title' => 'User profile',
'mobile-frontend-profile-last-upload-caption' =>
'{{GENDER:$2|Uploaded}} {{PLURAL:$1|yesterday|$1 days ago|0=today}}.',
'mobile-frontend-profile-usertalk' => 'Talk to $1',
- 'mobile-frontend-profile-noargs' => 'Please provide a username to view
a profile.',
- 'mobile-frontend-profile-nouser' => 'Non-existent or invalid username',
+ 'mobile-frontend-profile-error' => "Oh no!",
+ 'mobile-frontend-profile-noargs' => 'No username was given. Please
provide a username to view a profile.',
+ 'mobile-frontend-profile-nouser' => 'No user with this name exists.
Usernames are case sensitive so please check if it has been typed correctly.',
'mobile-frontend-profile-activity-heading' => 'Activity &
contributions',
- 'mobile-frontend-profile-yours' => 'Visit your profile page.',
'mobile-frontend-profile-userpage-link' => 'Visit user page.',
'mobile-frontend-requires-optin' => 'This page is not available unless
you opt into our beta mode. Visit the [[Special:MobileOptions|settings page]]
to opt in.',
'mobile-frontend-profile-last-thanked' => '{{GENDER:$1|Thanked}} by
[[Special:UserProfile/$1|$1]] for an edit to [[$2]].',
@@ -934,6 +934,7 @@
If the user is logged in, this message is followed by:
* {{msg-mw|Mobile-frontend-profile-yours}}',
+ 'mobile-frontend-profile-error' => 'Heading for errors on the profile
page.',
'mobile-frontend-profile-nouser' => 'Message shown when the username
requested is non-existent or invalid.
If the user is logged in, this message is followed by:
diff --git a/includes/specials/SpecialUserProfile.php
b/includes/specials/SpecialUserProfile.php
index 7d050bf..d55a73c 100644
--- a/includes/specials/SpecialUserProfile.php
+++ b/includes/specials/SpecialUserProfile.php
@@ -202,29 +202,11 @@
return Html::element( 'a', $attrs, $this->msg(
'mobile-frontend-profile-usertalk', $this->targetUser->getName() ) );
}
- // FIXME: Change this into 404 error
- protected function getHtmlNoArg() {
- $html = Html::element( 'p', array(), $this->msg(
'mobile-frontend-profile-noargs' ) );
- $user = $this->getUser();
- if ( $user->isLoggedIn() ) {
- $profileUrl = SpecialPage::getTitleFor(
$this->getName(), $user->getName() )->getLocalURL();
- $html .= Html::openElement( 'p', array() );
- $html .= Html::element( 'a', array( 'href' =>
$profileUrl ), $this->msg( 'mobile-frontend-profile-yours' )->plain() );
- $html .= Html::closeElement( 'p', array() );
- }
- return $html;
- }
-
- // FIXME: Change this into 404 error (and possibly merge with
getHtmlNoArg)
protected function getHtmlNoUser() {
- $html = Html::element( 'p', array(), $this->msg(
'mobile-frontend-profile-nouser' ) );
- $user = $this->getUser();
- if ( $user->isLoggedIn() ) {
- $profileUrl = SpecialPage::getTitleFor(
$this->getName(), $user->getName() )->getLocalURL();
- $html .= Html::openElement( 'p', array() );
- $html .= Html::element( 'a', array( 'href' =>
$profileUrl ), $this->msg( 'mobile-frontend-profile-yours' )->plain() );
- $html .= Html::closeElement( 'p', array() );
- }
+ $html = Html::openElement( 'div', array( 'class' => 'alert
error' ) );
+ $html .= Html::element( 'h2', array(), $this->msg(
'mobile-frontend-profile-error' ) );
+ $html .= Html::element( 'p', array(), $this->msg(
'mobile-frontend-profile-nouser' ) );
+ $html .= Html::closeElement( 'div' );
return $html;
}
@@ -342,13 +324,14 @@
} else {
$html = $this->getHtmlNoUser();
+ $out->addHtml( $html );
}
} else {
- $html = $this->getHtmlNoArg();
+ wfHttpError( 404, $this->msg(
'mobile-frontend-profile-error' )->text(),
+ $this->msg( 'mobile-frontend-profile-noargs'
)->text() );
}
$out->setPageTitle( $pageTitle );
wfProfileOut( __METHOD__ );
- $out->addHtml( $html );
}
/**
diff --git a/less/specials/common.less b/less/specials/common.less
index 7065f90..30ecca2 100644
--- a/less/specials/common.less
+++ b/less/specials/common.less
@@ -22,4 +22,11 @@
font-size: 1.2em;
color: @grayMedium;
}
+
+ .error {
+ h2 {
+ margin-top: 0;
+ text-transform: none;
+ }
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/96163
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfcf2c9ac4d58fc8bacbe4617b024a255a5469b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits