r52467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52466‎ | r52467 | r52468 >
Date:16:22, 26 June 2009
Author:werdna
Status:deferred
Tags:
Comment:
Fix doubled up fragments
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php
@@ -24,7 +24,7 @@
2525 $this->editedness = $t->editedness;
2626
2727 $this->replies = array();
28 - foreach ( $t->replies as $r ) {
 28+ foreach ( $t->replies() as $r ) {
2929 $this->replies[] = new HistoricalThread( $r );
3030 }
3131 }
Index: trunk/extensions/LiquidThreads/classes/LqtView.php
@@ -417,10 +417,14 @@
418418 // This results in a new Thread object not being created for replies and new discussions,
419419 // so $thread is null. In that case, just allow editpage to redirect back to the talk page.
420420 if ( $this->output->getRedirect() != '' && $thread ) {
421 - $this->output->redirect( $this->title->getFullURL() . '#' . 'lqt_thread_' . $thread->id() );
 421+ $redirectTitle = clone $this->title;
 422+ $redirectTitle->setFragment( '#'.$this->anchorName( $thread ) );
 423+ $this->output->redirect( $this->title->getFullURL() );
422424 } else if ( $this->output->getRedirect() != '' && $edit_applies_to ) {
423425 // For summaries:
424 - $this->output->redirect( $edit_applies_to->title()->getFullURL() . '#' . 'lqt_thread_' . $edit_applies_to->id() );
 426+ $redirectTitle = clone $edit_applies_to->title();
 427+ $redirectTitle->setFragment( '#'.$this->anchorName( $edit_applies_to ) );
 428+ $this->output->redirect( $redirectTitle->getFullURL() );
425429 }
426430 }
427431
Index: trunk/extensions/LiquidThreads/classes/LqtThread.php
@@ -426,9 +426,12 @@
427427 // Update: this doesn't work for some reason, but why do we update the replies array
428428 // in the first place after creating a new reply?
429429 $new_array = array();
430 - foreach ( $this->replies as $r )
431 - $new_array[] = $r;
432 - $this->replies = $new_array;
 430+
 431+ if( $this->replies ) {
 432+ foreach ( $this->replies as $r )
 433+ $new_array[] = $r;
 434+ $this->replies = $new_array;
 435+ }
433436 }
434437
435438 /*

Status & tagging log