r110402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110401‎ | r110402 | r110403 >
Date:16:34, 31 January 2012
Author:gregchiasson
Status:ok
Tags:aft 
Comment:
AFT5 - fix issues raised on r110326 - whitespace instead of tabs, inefficient regex in JS, and wrong function to build permalink.
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -85,7 +85,7 @@
8686
8787 // Process anything we found in the URL hash
8888 // Permalinks.
89 - var id = window.location.href.match(/(.+)\/(\d+)$/)
 89+ var id = window.location.href.match(/\/(\d+)$/)
9090 if( id ) {
9191 $.articleFeedbackv5special.listControls.filter = 'id';
9292 $.articleFeedbackv5special.listControls.filterValue = id[2];
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
@@ -468,36 +468,34 @@
469469 }
470470
471471 private function renderPermalinkTimestamp( $record ) {
472 - global $wgLang;
473 - $id = $record->af_id;
 472+ global $wgLang;
 473+ $id = $record->af_id;
474474 $title = $record->page_title;
475475
476 - // Taken from the Moodbar extension.
477 - $now = wfTimestamp( TS_UNIX );
478 - $timestamp = wfTimestamp( TS_UNIX, $record->af_created );
479 - $date = '';
 476+ // Taken from the Moodbar extension.
 477+ $now = wfTimestamp( TS_UNIX );
 478+ $timestamp = wfTimestamp( TS_UNIX, $record->af_created );
 479+ $date = '';
480480
481 - // Relative dates for 48 hours, normal timestamps later.
482 - if ( $timestamp > ( $now - ( 86400 * 2 ) ) ) {
483 - $time = $wgLang->formatTimePeriod(
484 - ( $now - $timestamp ), 'avoidseconds'
485 - );
486 - $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped();
487 - } elseif( $timestamp ) {
488 - $date = $wgLang->timeanddate($record->af_created );
489 - }
 481+ // Relative dates for 48 hours, normal timestamps later.
 482+ if ( $timestamp > ( $now - ( 86400 * 2 ) ) ) {
 483+ $time = $wgLang->formatTimePeriod(
 484+ ( $now - $timestamp ), 'avoidseconds'
 485+ );
 486+ $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped();
 487+ } elseif( $timestamp ) {
 488+ $date = $wgLang->timeanddate($record->af_created );
 489+ }
490490
491 - // format the element
492 - return Html::openElement( 'span', array(
493 - 'class' => 'articleFeedbackv5-comment-details-date'
494 - ) )
 491+ // format the element
 492+ return Html::openElement( 'span', array(
 493+ 'class' => 'articleFeedbackv5-comment-details-date'
 494+ ) )
495495 . Linker::link(
496 - Title::newFromText(
497 - "Special:ArticleFeedbackv5/$title/$id"
498 - ),
 496+ SpecialPage::getTitleFor( 'ArticleFeedbackv5', "$title/$id" ),
499497 $date
500498 )
501 - . Html::closeElement( 'span' );
 499+ . Html::closeElement( 'span' );
502500 }
503501
504502 private function renderBucket1( $record ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r110403AFT5 - fix bug introduced in r110402 - wrong offset in regex returngregchiasson16:41, 31 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110326AFT5 bug fixes:...gregchiasson20:40, 30 January 2012

Status & tagging log