r95930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95929‎ | r95930 | r95931 >
Date:03:56, 1 September 2011
Author:johnduhart
Status:reverted (Comments)
Tags:
Comment:
(bug 5865) Warning on editing other user's userpage
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1437,6 +1437,8 @@
14381438 'edit-no-change' => 'Your edit was ignored, because no change was made to the text.',
14391439 'edit-already-exists' => 'Could not create a new page.
14401440 It already exists.',
 1441+'editinguserpage' => "'''Note:''' You are editing a [[Help:User page|user page]]. To leave this user a message, $1.",
 1442+'editinguserpagetalklink' => 'edit their talk page',
14411443 'addsection-preload' => '', # do not translate or duplicate this message to other languages
14421444 'addsection-editintro' => '', # do not translate or duplicate this message to other languages
14431445
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -51,6 +51,7 @@
5252 * (bug 30344) Add configuration variable for setting custom priorities when
5353 generating sitemaps
5454 * (bug 16428) Include permalink in printable version
 55+* (bug 5865) Warning on editing other user's userpage
5556
5657 === Bug fixes in 1.19 ===
5758 * $wgUploadNavigationUrl should be used for file redlinks if
Index: trunk/phase3/includes/EditPage.php
@@ -1605,6 +1605,17 @@
16061606 }
16071607 }
16081608
 1609+ $curUP = $wgUser->getUserPage();
 1610+ $sk = $wgOut->getSkin();
 1611+ if ( $this->mTitle->getNamespace() == NS_USER
 1612+ && substr( $this->mTitle->getPrefixedText(), 0, strlen( $curUP->getPrefixedText() ) ) != $curUP->getPrefixedText()
 1613+ && $this->formtype != 'preview'
 1614+ && $this->formtype != 'diff' )
 1615+ {
 1616+ $utpLink = $sk->makeKnownLinkObj( $this->mTitle->getTalkPage(), wfMsgHtml( 'editinguserpagetalklink' ), 'action=edit' );
 1617+ $wgOut->addHTML( wfMsgWikiHtml( 'editinguserpage', $utpLink ) );
 1618+ }
 1619+
16091620 if ( wfReadOnly() ) {
16101621 $wgOut->wrapWikiMsg( "<div id=\"mw-read-only-warning\">\n$1\n</div>", array( 'readonlywarning', wfReadOnlyReason() ) );
16111622 } elseif ( $wgUser->isAnon() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r95931Follow-up r95930, consolidate into one message per CRjohnduhart04:26, 1 September 2011
r95939f'up r95930: register new message key to maintenance scriptraymond06:18, 1 September 2011
r96046Revert r95930, r95931 and r95939. Poorly commited patchjohnduhart21:32, 1 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r14768(bug 5865) Show warning when editing another users' user page and provide a l...robchurch06:55, 15 June 2006

Comments

#Comment by Krinkle (talk | contribs)   03:58, 1 September 2011

user page does not exist on new wikis. Do we want to link to it here ?

Also, splitting messages in two parts should be avoided at all times. It's an unlivable mess for translators. Use

[[$1|linktext]] or [$1 linktext]
#Comment by Johnduhart (talk | contribs)   04:24, 1 September 2011

No, in all the system messages I've seen linking to help pages it's always local and never back here.

#Comment by Krinkle (talk | contribs)   04:01, 1 September 2011

by user page I meant Help:User page.

Also, just noticed makeKnownLinkObj has been deprecated. Use Linker::link() (or a getUrl method of the Title object) instead.

#Comment by Siebrand (talk | contribs)   06:09, 1 September 2011

Key 'editinguserpage' should be adder to phase3/languages/messages.inc - the Other key that was added, has already been removed again.

#Comment by IAlex (talk | contribs)   06:13, 1 September 2011

Linker::makeKnownLinkObj() is deprecated, please use Linker::link() instead and call it statically.

#Comment by Dantman (talk | contribs)   06:42, 1 September 2011

This warning won't show up for User:Foo when editing User:FooBar.

I find the comparison of getPrefixedText to be quite ugly, you're essentially including the i18ned namespace 'User:' with your comparison instead of just comparing the actual text normally.

IMHO this makes me want to add ->isSubpageOf to our ->equals. `if ( $title->getNamespace() === NS_USER && !$title->equals( $curUP ) && !$title->isSubpageOf( $curUP ) )`.

#Comment by Nikerabbit (talk | contribs)   06:55, 1 September 2011

The edit page is already full of warnings the user doesn't bother to eat. Is this warning really useful or just more interface cruft? The bug report already has much of this skepticism.

#Comment by Siebrand (talk | contribs)   12:41, 1 September 2011

+1

#Comment by P858snake (talk | contribs)   07:00, 1 September 2011

If you are applying someone else's patch, you should include "Patch by X" in the commit summary.

#Comment by Siebrand (talk | contribs)   12:44, 1 September 2011

If this commit remains in, the message must be changed. Because this message is written in the user language, the page name "Help:User page" will also be translated, but it shouldn't be. It should be the same page in all languages within one wiki.

For this we use something like "[[MediaWiki:Help-userpage-url|User page]]" where they key "help-userpage-url" is "Help:User page". See other uses in MediaWiki core.

Status & tagging log