Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -208,6 +208,17 @@ |
209 | 209 | if ( is_array($query) ) $query = self::queryStringFromArray($query); |
210 | 210 | return $thread->root()->getTitle()->getFullUrl($query); |
211 | 211 | } |
| 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 | + } |
212 | 223 | |
213 | 224 | static function talkpageUrl( $title, $method = null, $operand = null ) { |
214 | 225 | $query = $method ? "lqt_method=$method" : ""; |
— | — | @@ -1085,8 +1096,9 @@ |
1086 | 1097 | else if( $this->thread->changeType() == Threads::CHANGE_REPLY_CREATED ) { |
1087 | 1098 | $this->output->addHTML('The highlighted comment was created in this revision.'); |
1088 | 1099 | } else if( $this->thread->changeType() == Threads::CHANGE_EDITED_ROOT ) { |
| 1100 | + $diff_url = $this->permalinkUrlWithDiff($this->thread); |
1089 | 1101 | $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>]" ); |
1091 | 1103 | } |
1092 | 1104 | $this->closeDiv(); |
1093 | 1105 | } |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -352,8 +352,6 @@ |
353 | 353 | |
354 | 354 | $this->replies = $children; |
355 | 355 | |
356 | | - $this->double = clone $this; |
357 | | - |
358 | 356 | /* |
359 | 357 | Root revision is ignored on live threads but will be important when |
360 | 358 | when we save a historical thread, since by that time an edit will |
— | — | @@ -365,6 +363,9 @@ |
366 | 364 | */ |
367 | 365 | $rev = Revision::newFromTitle( $this->root()->getTitle() ); |
368 | 366 | $this->double->rootRevision = $rev->getId(); |
| 367 | + |
| 368 | + |
| 369 | + $this->double = clone $this; |
369 | 370 | } |
370 | 371 | |
371 | 372 | /* |
— | — | @@ -536,8 +537,19 @@ |
537 | 538 | return $this->changeType; |
538 | 539 | } |
539 | 540 | |
| 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 | + } |
540 | 552 | function changeObject() { |
541 | | - return $this->changeObject; |
| 553 | + return $this->replyWithId( $this->changeObject ); |
542 | 554 | } |
543 | 555 | |
544 | 556 | function setChangeType($t) { |