r101611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101610‎ | r101611 | r101612 >
Date:10:54, 2 November 2011
Author:catrope
Status:ok
Tags:aft 
Comment:
Fix r101532 which was so broken that I refuse to believe it was tested even once:
* Feeding a fully-qualified URL through mw.util.wikiGetlink() prefixes wgServer, which breaks the link
* articlefeedback-survey-disclaimer containted wiki syntax for an external link, but this doesn't work in JS
* Links in the survey dialog show up in black due to some annoying JUI CSS, so even if that wiki syntax had worked, it wouldn't have produced a visually discernable link

Fixes:
* Remove mw.util.wikiGetLink() calls
* Split up articlefeedback-survey-disclaimer the way articlefeedback-form-panel-helpimprove-note is, with a separate message for the link text
** Document these split messages in qqq
* Move the link target out of a message and into a global
* Add a CSS workaround to make the privacy link in the survey dialog show up in blue rather than in black
Modified paths:
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.css (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -592,13 +592,13 @@
593593 .find( '.articleFeedback-helpimprove-note' )
594594 // Can't use .text() with mw.message(, /* $1 */ link).toString(),
595595 // because 'link' should not be re-escaped (which would happen if done by mw.message)
596 - .html( function(){
 596+ .html( function() {
597597 var link = mw.html.element(
598598 'a', {
599 - href: mw.util.wikiGetlink( mw.msg('articlefeedback-form-panel-helpimprove-privacylink') )
600 - }, mw.msg('articlefeedback-form-panel-helpimprove-privacy')
 599+ href: context.options.privacyURL
 600+ }, mw.msg( 'articlefeedback-form-panel-helpimprove-privacy' )
601601 );
602 - return mw.html.escape( mw.msg( 'articlefeedback-form-panel-helpimprove-note') )
 602+ return mw.html.escape( mw.msg( 'articlefeedback-form-panel-helpimprove-note' ) )
603603 .replace( /\$1/, link );
604604 })
605605 .end()
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.css
@@ -10,3 +10,7 @@
1111 font-weight: normal; /* Override bold */
1212 font-style: italic;
1313 }
 14+
 15+.articleFeedback-survey-disclaimer a {
 16+ color: #0645AD; /* Override blackish color set by JUI */
 17+}
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js
@@ -116,7 +116,21 @@
117117 $form.find( '#prefswitch-survey-origin' ).text( mw.config.get( 'wgTitle' ) );
118118
119119 // Insert disclaimer message
120 - $button.before( $( '<div>' ).addClass( 'articleFeedback-survey-disclaimer' ).text( mw.msg( 'articlefeedback-survey-disclaimer' ) ) );
 120+ $button.before(
 121+ $( '<div>' )
 122+ .addClass( 'articleFeedback-survey-disclaimer' )
 123+ // Can't use .text() with mw.message(, /* $1 */ link).toString(),
 124+ // because 'link' should not be re-escaped (which would happen if done by mw.message)
 125+ .html( function() {
 126+ var link = mw.html.element(
 127+ 'a', {
 128+ href: mw.config.get( 'wgArticleFeedbackPrivacyURL' )
 129+ }, mw.msg( 'articlefeedback-survey-disclaimerlink' )
 130+ );
 131+ return mw.html.escape( mw.msg( 'articlefeedback-survey-disclaimer' ) )
 132+ .replace( /\$1/, link );
 133+ })
 134+ );
121135
122136 // Take dialog out of loading state
123137 $dialog.removeClass( 'loading' );
@@ -298,7 +312,8 @@
299313 'accept': 'articlefeedback-pitch-edit-accept',
300314 'reject': 'articlefeedback-pitch-reject'
301315 }
302 - }
 316+ },
 317+ 'privacyURL': mw.config.get( 'wgArticleFeedbackPrivacyURL' )
303318 };
304319
305320 /* Load at the bottom of the article */
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php
@@ -26,7 +26,8 @@
2727 'articlefeedback-survey-submit' => 'Submit',
2828 'articlefeedback-survey-title' => 'Please answer a few questions',
2929 'articlefeedback-survey-thanks' => 'Thanks for filling out the survey.',
30 - 'articlefeedback-survey-disclaimer' => 'By submitting, you agree to transparency under these [http://wikimediafoundation.org/wiki/Feedback_privacy_statement terms]',
 30+ 'articlefeedback-survey-disclaimer' => 'By submitting, you agree to transparency under these $1.',
 31+ 'articlefeedback-survey-disclaimerlink' => 'terms',
3132 /* ext.articleFeedback and jquery.articleFeedback */
3233 'articlefeedback-error' => 'An error has occured. Please try again later.',
3334 'articlefeedback-form-switch-label' => 'Rate this page',
@@ -43,7 +44,6 @@
4445 'articlefeedback-form-panel-helpimprove-note' => 'We will send you a confirmation e-mail. We will not share your e-mail address with outside parties as per our $1.',
4546 'articlefeedback-form-panel-helpimprove-email-placeholder' => 'email@example.org', // Optional
4647 'articlefeedback-form-panel-helpimprove-privacy' => 'feedback privacy statement',
47 - 'articlefeedback-form-panel-helpimprove-privacylink' => 'http://wikimediafoundation.org/wiki/Feedback_privacy_statement',
4848 'articlefeedback-form-panel-submit' => 'Submit ratings',
4949 'articlefeedback-form-panel-pending' => 'Your ratings have not been submitted yet',
5050 'articlefeedback-form-panel-success' => 'Saved successfully',
@@ -171,11 +171,12 @@
172172 {{Identical|Submit}}',
173173 'articlefeedback-survey-title' => 'This text appears in the title bar of the survey dialog.',
174174 'articlefeedback-survey-thanks' => 'This text appears when the user has successfully submitted the survey.',
175 - 'articlefeedback-survey-disclaimer' => 'This text appears on the survey form below the comment field and above the submit button.',
 175+ 'articlefeedback-survey-disclaimer' => 'This text appears on the survey form below the comment field and above the submit button. $1 is a link pointing to the privacy policy. The link text is in the articlefeedback-survey-disclaimerlink message.',
176176 'articlefeedback-form-panel-explanation' => '{{Identical|What is this}}',
177177 'articlefeedback-form-panel-explanation-link' => 'Do not translate "Project:". Also translate the "ArticleFeedback" special page name at [[Special:AdvancedTranslate]].',
178178 'articlefeedback-form-panel-helpimprove' => 'This message should use {{SITENAME}}.',
179179 'articlefeedback-form-panel-helpimprove-email-placeholder' => '{{Optional}}',
 180+ 'articlefeedback-form-panel-helpimprove-note' => '$1 is a link pointing to the privacy policy. The link text is in the articlefeedback-form-panel-helpimprove-privacy message.',
180181 'articlefeedback-form-panel-helpimprove-privacy' => '{{Identical|Privacy}}',
181182 'articlefeedback-form-panel-helpimprove-privacylink' => 'Do not translate "Project:"
182183 {{Identical|Privacypage}}',
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php
@@ -88,6 +88,11 @@
8989 */
9090 $wgArticleFeedbackDashboardTalkPage = "http://www.mediawiki.org/wiki/Talk:Article_feedback";
9191
 92+/**
 93+ * The full URL for the privacy policy links
 94+ */
 95+$wgArticleFeedbackPrivacyURL = 'http://wikimediafoundation.org/wiki/Feedback_privacy_statement';
 96+
9297 // Would ordinarily call this articlefeedback but survey names are 16 chars max
9398 $wgPrefSwitchSurveys['articlerating'] = array(
9499 'updatable' => false,
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php
@@ -35,7 +35,8 @@
3636 'articlefeedback-survey-title',
3737 'articlefeedback-survey-message-success',
3838 'articlefeedback-survey-message-error',
39 - 'articlefeedback-survey-disclaimer'
 39+ 'articlefeedback-survey-disclaimer',
 40+ 'articlefeedback-survey-disclaimerlink'
4041 ),
4142 'dependencies' => array(
4243 'jquery.ui.dialog',
@@ -72,7 +73,6 @@
7374 'articlefeedback-form-panel-helpimprove-note',
7475 'articlefeedback-form-panel-helpimprove-email-placeholder',
7576 'articlefeedback-form-panel-helpimprove-privacy',
76 - 'articlefeedback-form-panel-helpimprove-privacylink',
7777 'articlefeedback-form-panel-submit',
7878 'articlefeedback-form-panel-success',
7979 'articlefeedback-form-panel-pending',
@@ -279,7 +279,8 @@
280280 $wgArticleFeedbackTracking,
281281 $wgArticleFeedbackOptions,
282282 $wgArticleFeedbackNamespaces,
283 - $wgArticleFeedbackRatingTypes;
 283+ $wgArticleFeedbackRatingTypes,
 284+ $wgArticleFeedbackPrivacyURL;
284285 $vars['wgArticleFeedbackSMaxage'] = $wgArticleFeedbackSMaxage;
285286 $vars['wgArticleFeedbackCategories'] = $wgArticleFeedbackCategories;
286287 $vars['wgArticleFeedbackBlacklistCategories'] = $wgArticleFeedbackBlacklistCategories;
@@ -289,6 +290,7 @@
290291 $vars['wgArticleFeedbackNamespaces'] = $wgArticleFeedbackNamespaces;
291292 $vars['wgArticleFeedbackWhatsThisPage'] = wfMsgForContent( 'articlefeedback-form-panel-explanation-link' );
292293 $vars['wgArticleFeedbackRatingTypesFlipped'] = array_flip( $wgArticleFeedbackRatingTypes );
 294+ $vars['wgArticleFeedbackPrivacyURL'] = $wgArticleFeedbackPrivacyURL;
293295 return true;
294296 }
295297

Follow-up revisions

RevisionCommit summaryAuthorDate
r101617Followup r101611, move the privacy policy URL back into a message. Kaldari ma...catrope11:31, 2 November 2011
r1016601.18wmf1: Merge stuff for editor engagement deployment...catrope19:01, 2 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101532Updated language as per requests from WMF legal department.tparscal21:36, 1 November 2011

Status & tagging log