r24772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24771‎ | r24772 | r24773 >
Date:07:00, 14 August 2007
Author:david
Status:old
Tags:
Comment:
diffs! except for one bug
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtModel.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -208,6 +208,17 @@
209209 if ( is_array($query) ) $query = self::queryStringFromArray($query);
210210 return $thread->root()->getTitle()->getFullUrl($query);
211211 }
 212+
 213+ static function permalinkUrlWithDiff( $thread ) {
 214+ // TODO, changeObjects should return the thread itself.
 215+ $changed_thread = $thread->changeObject();
 216+// $changed_thread = Threads::withId($thread->changeObject());
 217+ var_dump($changed_thread);
 218+ $curr_rev_id = $changed_thread->rootRevision();
 219+ $curr_rev = Revision::newFromTitle( $changed_thread->root()->getTitle(), $curr_rev_id );
 220+ $prev_rev = $curr_rev->getPrevious();
 221+ return self::permalinkUrlWithQuery( $changed_thread, array('diff'=>$curr_rev_id, 'oldid'=>$prev_rev->getId()) );
 222+ }
212223
213224 static function talkpageUrl( $title, $method = null, $operand = null ) {
214225 $query = $method ? "lqt_method=$method" : "";
@@ -1085,8 +1096,9 @@
10861097 else if( $this->thread->changeType() == Threads::CHANGE_REPLY_CREATED ) {
10871098 $this->output->addHTML('The highlighted comment was created in this revision.');
10881099 } else if( $this->thread->changeType() == Threads::CHANGE_EDITED_ROOT ) {
 1100+ $diff_url = $this->permalinkUrlWithDiff($this->thread);
10891101 $this->output->addHTML('The highlighted comment was edited in this revision. ');
1090 - $this->output->addHTML( '[<a>show diffs</a>]' );
 1102+ $this->output->addHTML( "[<a href=\"$diff_url\">show diffs</a>]" );
10911103 }
10921104 $this->closeDiv();
10931105 }
Index: branches/liquidthreads/extensions/LqtModel.php
@@ -352,8 +352,6 @@
353353
354354 $this->replies = $children;
355355
356 - $this->double = clone $this;
357 -
358356 /*
359357 Root revision is ignored on live threads but will be important when
360358 when we save a historical thread, since by that time an edit will
@@ -365,6 +363,9 @@
366364 */
367365 $rev = Revision::newFromTitle( $this->root()->getTitle() );
368366 $this->double->rootRevision = $rev->getId();
 367+
 368+
 369+ $this->double = clone $this;
369370 }
370371
371372 /*
@@ -536,8 +537,19 @@
537538 return $this->changeType;
538539 }
539540
 541+ private function replyWithId($id) {
 542+ if( $this->id == $id ) return $this;
 543+ foreach ( $this->replies as $r ) {
 544+ if( $r->id() == $id ) return $r;
 545+ else {
 546+ $s = $r->replyWithId($id);
 547+ if( $s ) return $s;
 548+ }
 549+ }
 550+ return null;
 551+ }
540552 function changeObject() {
541 - return $this->changeObject;
 553+ return $this->replyWithId( $this->changeObject );
542554 }
543555
544556 function setChangeType($t) {

Status & tagging log