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

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(-)

Approvals:
  Siebrand: Looks good to me, but someone else must approve
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 3553e48..7c61d5a 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -343,10 +343,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]].',
@@ -956,6 +956,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 0ce8294..5e9219b 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;
        }
 
@@ -343,11 +325,12 @@
                        } 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() );
                }
                wfProfileOut( __METHOD__ );
-               $out->addHtml( $html );
        }
 
        /**
diff --git a/less/specials/common.less b/less/specials/common.less
index 1088dce..f1e95f4 100644
--- a/less/specials/common.less
+++ b/less/specials/common.less
@@ -26,4 +26,11 @@
        h2 {
                font-family: @fontFamily;
        }
+
+       .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: merged
Gerrit-Change-Id: Icfcf2c9ac4d58fc8bacbe4617b024a255a5469b4
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[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