r99357 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99356‎ | r99357 | r99358 >
Date:16:09, 9 October 2011
Author:kwisatz
Status:resolved (Comments)
Tags:
Comment:
added message to special page when already logged in
Modified paths:
  • /trunk/extensions/TwitterLogin/SpecialTwitterLogin.php (modified) (history)
  • /trunk/extensions/TwitterLogin/TwitterLogin.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TwitterLogin/TwitterLogin.i18n.php
@@ -26,6 +26,7 @@
2727 'signuptwitter' => 'You can register to this wiki using your twitter account',
2828 'tietoaccount' => 'You are currently logged into this wiki as $1.<br/>You may sign in with Twitter to tie your twitter account to your existing mediawiki account.',
2929 'twitterlogin-desc' => 'Register and log in to a mediawiki using your twitter account',
 30+ 'alreadyloggedin' => 'You\'re already logged in.',
3031 'couldnotconnect' => 'Could not connect to Twitter. Refresh the page or try again later.'
3132 );
3233
Index: trunk/extensions/TwitterLogin/SpecialTwitterLogin.php
@@ -53,18 +53,19 @@
5454
5555 private function _default(){
5656 global $wgOut, $wgUser, $wgScriptPath, $wgExtensionAssetsPath;
 57+
5758 $wgOut->setPagetitle("Twitter Login");
5859
59 - /*
60 - if( $wgUser->isLoggedIn() )
61 - $wgOut->addWikiText( wfMsg( 'tietoaccount', $wgUser->getName() ) );
62 - else
63 - */
64 - $wgOut->addWikiText( wfMsg( 'signuptwitter') );
 60+ if ( !$wgUser->isLoggedIn() ) {
 61+ $wgOut->addWikiText( wfMsg( 'signuptwitter') );
6562
66 - $wgOut->addHTML( '<a href="' . $wgScriptPath . '/index.php/Special:TwitterLogin/redirect">'
 63+ $wgOut->addHTML( '<a href="' . $wgScriptPath . '/index.php/Special:TwitterLogin/redirect">'
6764 .'<img src="' . $wgExtensionAssetsPath . '/TwitterLogin/' .
6865 'images/sign-in-with-twitter-d.png"/></a>' );
 66+ } else {
 67+ //$wgOut->addWikiText( wfMsg( 'tietoaccount', $wgUser->getName() ) );
 68+ $wgOut->addWikiText( wfMsg( 'alreadyloggedin' ) );
 69+ }
6970 return true;
7071 }
7172
@@ -246,7 +247,7 @@
247248 }
248249 }
249250
250 - private function _doTwitterOAuth($at, $ats){
 251+ private function _doTwitterOAuth( $at, $ats ){
251252 /* Get user access tokens out of the session. */
252253 return new TwitterOAuth(
253254 $this->_consumerKey,

Follow-up revisions

RevisionCommit summaryAuthorDate
r99361Follow up to r99355 and r99357: used TitleObject->getFullURL() and prefixed t...kwisatz18:32, 9 October 2011
r99406follow up to r99357: used addWikiMsg() instead of addWikiText( wfMsg() )kwisatz16:20, 10 October 2011

Comments

#Comment by Siebrand (talk | contribs)   16:51, 9 October 2011

I think core already has an error message for the same context. If you want to keep it in the extension, please ensure that the message keys have an extension specific prefix.

Please add message documentation for the newly added messages. Thanks.

#Comment by Clausekwis (talk | contribs)   16:54, 9 October 2011

Can you verify r99358 for the message prefixes? Should be resolved by that commit.

#Comment by Siebrand (talk | contribs)   17:42, 9 October 2011

Ah, yes, that looks fine. Message documentation remains to be done.

#Comment by Nikerabbit (talk | contribs)   21:12, 9 October 2011

Please use addWikiMsg( 'key' ) instead of addWikiText( wfMsg( 'key' ) ).

Status & tagging log