r90956 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90955‎ | r90956 | r90957 >
Date:13:51, 28 June 2011
Author:janpaul123
Status:ok (Comments)
Tags:
Comment:
Fixes posting to anonymous users. Also shows a warning when posting to anonymous users, this fixes bug 29620
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.api.php (modified) (history)
  • /trunk/extensions/WikiLove/WikiLove.hooks.php (modified) (history)
  • /trunk/extensions/WikiLove/WikiLove.i18n.php (modified) (history)
  • /trunk/extensions/WikiLove/WikiLove.php (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.php
@@ -125,6 +125,7 @@
126126 'wikilove-err-gallery',
127127 'wikilove-err-gallery-again',
128128 'wikilove-what-is-this',
 129+ 'wikilove-anon-warning',
129130 ),
130131 'dependencies' => array(
131132 'jquery.ui.dialog',
Index: trunk/extensions/WikiLove/WikiLove.hooks.php
@@ -71,7 +71,7 @@
7272 $out->addModules( 'ext.wikiLove.defaultOptions' );
7373 }
7474
75 - self::$recipient = $title->getText();
 75+ self::$recipient = $title->getBaseText();
7676 }
7777 return true;
7878 }
@@ -83,6 +83,12 @@
8484 global $wgUser;
8585 $vars['wikilove-recipient'] = self::$recipient;
8686 $vars['wikilove-edittoken'] = $wgUser->edittoken();
 87+
 88+ $vars['wikilove-anon'] = 0;
 89+ if ( self::$recipient !== '' ) {
 90+ $receiver = User::newFromName( self::$recipient );
 91+ if ( $receiver === false || $receiver->isAnon() ) $vars['wikilove-anon'] = 1;
 92+ }
8793 return true;
8894 }
8995
Index: trunk/extensions/WikiLove/WikiLove.api.php
@@ -56,7 +56,7 @@
5757 global $wgUser;
5858 $dbw = wfGetDB( DB_MASTER );
5959 $receiver = User::newFromName( $talk->getSubjectPage()->getBaseText() );
60 - if ( $receiver->isAnon() ) {
 60+ if ( $receiver === false || $receiver->isAnon() ) {
6161 $this->setWarning( 'Not logging anonymous recipients' );
6262 return;
6363 }
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -59,6 +59,7 @@
6060 <p><a target="_blank" href="http://www.mediawiki.org/wiki/WikiLove">\
6161 <html:msg key="wikilove-what-is-this"/>\
6262 </a></p>\
 63+ <p id="mw-wikilove-anon-warning"><strong><html:msg key="wikilove-anon-warning"/></strong></p>\
6364 </div>\
6465 <div id="mw-wikilove-add-details">\
6566 <span class="mw-wikilove-number">2</span>\
@@ -131,6 +132,8 @@
132133 $( '#mw-wikilove-send-form' ).click( $.wikiLove.submitSend );
133134 $( '#mw-wikilove-message' ).elastic(); // have the message textarea grow automatically
134135
 136+ if ( mw.config.get( 'wikilove-anon' ) === 0 ) $( '#mw-wikilove-anon-warning' ).hide();
 137+
135138 // when the input changes, we want to disable the send button
136139 $( '#mw-wikilove-header' ).change( $.wikiLove.changeInput );
137140 $( '#mw-wikilove-header' ).keyup( $.wikiLove.changeInput );
Index: trunk/extensions/WikiLove/WikiLove.i18n.php
@@ -47,6 +47,7 @@
4848 'wikilove-err-gallery-again' => 'Try again',
4949 'wikilove-summary' => '/* $1 */ new WikiLove message',
5050 'wikilove-what-is-this' => "What is this?",
 51+ 'wikilove-anon-warning' => 'Note: This user is not registered, he or she many not notice this message.',
5152 );
5253
5354 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r91166Fix typorobin13:03, 30 June 2011

Comments

#Comment by He7d3r (talk | contribs)   20:34, 30 June 2011

Is this deployed on Prototype? I was able to post for an nonexistent "User:Example/a/b/c/d": http://prototype.wikimedia.org/release-en/User_talk:Example/a/b/c/d#A_barnstar_for_you.21

PS: There is a typo on "he or she many not notice".

#Comment by TheDJ (talk | contribs)   20:39, 30 June 2011

typo fixed in r91166

Status & tagging log