r24301 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24300‎ | r24301 | r24302 >
Date:03:39, 21 July 2007
Author:david
Status:old
Tags:
Comment:
Reasonable behavior if there are no threads in the archive. Also, turned subject-renaming back on to start debugging it, but now it just works without any changes. No idea why.
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -327,7 +327,7 @@
328328 if( $edit_type == 'editExisting' && $e->didSave ) {
329329 $subject = $this->request->getVal('lqt_subject_field', '');
330330 if ( $subject && $subject != $thread->subjectWithoutIncrement() ) {
331 - //$this->renameThread($thread, $subject);
 331+ $this->renameThread($thread, $subject);
332332 }
333333 // this is unrelated to the subject change and is for all edits:
334334 $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) );
@@ -828,8 +828,13 @@
829829 return $res;
830830 }
831831
 832+ /* @return True if there are no threads to show, false otherwise.
 833+ TODO is is somewhat bizarre. */
832834 function showSearchForm() {
833835 $months = Threads::monthsWhereArticleHasThreads($this->article);
 836+ if (count($months) == 0) {
 837+ return true;
 838+ }
834839
835840 $use_dates = $this->request->getVal('lqt_archive_filter_by_date', null);
836841 if ( $use_dates === null ) {
@@ -889,6 +894,7 @@
890895 </form>
891896 HTML
892897 );
 898+ return false;
893899 }
894900
895901 function show() {
@@ -898,7 +904,11 @@
899905 $this->output->setPageTitle( "Talk:" . $this->title->getText() ); // TODO non-main namespaces.
900906 $this->addJSandCSS();
901907
902 - $this->showSearchForm();
 908+ $empty = $this->showSearchForm();
 909+ if ($empty) {
 910+ $this->output->addHTML('<p>There are no threads in the archive.');
 911+ return;
 912+ }
903913
904914 $this->output->addHTML(<<<HTML
905915 <p class="lqt_search_annotations">{$this->annotations}</p>

Status & tagging log