Index: trunk/extensions/LiquidThreads/lqt-schema-change-5.sql |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +alter table thread add column thread_editedness int(1) NOT NULL default 0; |
| 3 | + |
| 4 | +update thread join thread as child on child.thread_parent = thread.thread_id set thread.thread_editedness = 1; |
| 5 | + |
| 6 | +create temporary table counts ( thread_id int(8) unsigned, revision_count int(8) unsigned, author_count int(8) unsigned, rev_user int(8) unsigned ); |
| 7 | + |
| 8 | +insert into counts (thread_id, revision_count, author_count, rev_user) select thread_id, count(thread_id), count(distinct rev_user), rev_user from thread join revision on rev_page = thread_root group by thread_id; |
| 9 | + |
| 10 | +update thread join counts on thread.thread_id = counts.thread_id set thread_editedness = 2 where revision_count > 1; |
| 11 | + |
| 12 | +update thread join counts on thread.thread_id = counts.thread_id set thread_editedness = 3 where author_count > 1 or (rev_user = 0 and revision_count > 1); |
| 13 | + |
| 14 | +drop table counts; |
Index: trunk/extensions/LiquidThreads/Lqt.i18n.php |
— | — | @@ -20,6 +20,8 @@ |
21 | 21 | 'lqt_add_header' => 'Add header', |
22 | 22 | 'lqt_new_thread' => 'Start a new discussion', |
23 | 23 | 'lqt_in_response_to' => 'In reply to $1 by $2, above:', |
| 24 | + 'lqt_edited_notice_author' => "This message was re-edited by the original author.", |
| 25 | + 'lqt_edited_notice_others' => "This message was edited by someone other than the author.", |
24 | 26 | 'lqt_move_placeholder' => "''Placeholder left when the thread was moved to another page.''", |
25 | 27 | 'lqt_reply' => 'Reply', |
26 | 28 | 'lqt_delete' => 'Delete', |
Index: trunk/extensions/LiquidThreads/LqtModel.php |
— | — | @@ -168,6 +168,7 @@ |
169 | 169 | $this->changeComment = $t->changeComment; |
170 | 170 | $this->changeUser = $t->changeUser; |
171 | 171 | $this->changeUserText = $t->changeUserText; |
| 172 | + $this->editedness = $t->editedness; |
172 | 173 | |
173 | 174 | $this->replies = array(); |
174 | 175 | foreach ($t->replies as $r) { |
— | — | @@ -239,6 +240,9 @@ |
240 | 241 | protected $revisionNumber; |
241 | 242 | protected $type; |
242 | 243 | |
| 244 | + /* Flag about who has edited or replied to this thread. */ |
| 245 | + protected $editedness; |
| 246 | + |
243 | 247 | /* Information about what changed in this revision. */ |
244 | 248 | protected $changeType; |
245 | 249 | protected $changeObject; |
— | — | @@ -347,6 +351,18 @@ |
348 | 352 | $this->bumpRevisionsOnAncestors($change_type, $change_object, $reason, wfTimestampNow()); |
349 | 353 | self::setChangeOnDescendents($this->topmostThread(), $change_type, $change_object); |
350 | 354 | |
| 355 | + if( $change_type == Threads::CHANGE_REPLY_CREATED |
| 356 | + && $this->editedness == Threads::EDITED_NEVER ) { |
| 357 | + $this->editedness = Threads::EDITED_HAS_REPLY; |
| 358 | + } |
| 359 | + else if( $change_type == Threads::CHANGE_EDITED_ROOT ) { |
| 360 | + if( $wgUser->getId() == 0 || $wgUser->getId() != $this->root()->originalAuthor()->getId() ) { |
| 361 | + $this->editedness = Threads::EDITED_BY_OTHERS; |
| 362 | + } else if( $this->editedness == Threads::EDITED_HAS_REPLY ) { |
| 363 | + $this->editedness = Threads::EDITED_BY_AUTHOR; |
| 364 | + } |
| 365 | + } |
| 366 | + |
351 | 367 | /* SCHEMA changes must be reflected here. */ |
352 | 368 | |
353 | 369 | $dbr =& wfGetDB( DB_MASTER ); |
— | — | @@ -360,6 +376,7 @@ |
361 | 377 | // 'thread_revision' => $this->revisionNumber, |
362 | 378 | 'thread_article_namespace' => $this->articleNamespace, |
363 | 379 | 'thread_article_title' => $this->articleTitle, |
| 380 | + 'thread_editedness' => $this->editedness, |
364 | 381 | // 'thread_change_type' => $this->changeType, |
365 | 382 | // 'thread_change_object' => $this->changeObject, |
366 | 383 | // 'thread_change_comment' => $this->changeComment, |
— | — | @@ -474,6 +491,7 @@ |
475 | 492 | $this->changeComment = $line->thread_change_comment; |
476 | 493 | $this->changeUser = $line->thread_change_user; |
477 | 494 | $this->changeUserText = $line->thread_change_user_text; |
| 495 | + $this->editedness = $line->thread_editedness; |
478 | 496 | |
479 | 497 | $root_title = Title::makeTitle( $line->page_namespace, $line->page_title ); |
480 | 498 | $this->root = new Post($root_title); |
— | — | @@ -600,6 +618,10 @@ |
601 | 619 | return $this->rootRevision; |
602 | 620 | } |
603 | 621 | |
| 622 | + function editedness() { |
| 623 | + return $this->editedness; |
| 624 | + } |
| 625 | + |
604 | 626 | function summary() { |
605 | 627 | if ( !$this->summaryId ) return null; |
606 | 628 | if ( !$this->summary ) $this->summary = new Post( Title::newFromID( $this->summaryId ) ); |
— | — | @@ -774,6 +796,12 @@ |
775 | 797 | static $VALID_CHANGE_TYPES = array(self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT, |
776 | 798 | self::CHANGE_REPLY_CREATED, self::CHANGE_NEW_THREAD, self::CHANGE_DELETED, self::CHANGE_UNDELETED, |
777 | 799 | self::CHANGE_MOVED_TALKPAGE); |
| 800 | + |
| 801 | + // Possible values of Thread->editedness. |
| 802 | + const EDITED_NEVER = 0; |
| 803 | + const EDITED_HAS_REPLY = 1; |
| 804 | + const EDITED_BY_AUTHOR = 2; |
| 805 | + const EDITED_BY_OTHERS = 3; |
778 | 806 | |
779 | 807 | static $cache_by_root = array(); |
780 | 808 | static $cache_by_id = array(); |
— | — | @@ -809,7 +837,8 @@ |
810 | 838 | 'thread_change_comment' => "", // TODO |
811 | 839 | 'thread_change_user' => $wgUser->getID(), |
812 | 840 | 'thread_change_user_text' => $wgUser->getName(), |
813 | | - 'thread_type' => $type), |
| 841 | + 'thread_type' => $type, |
| 842 | + 'thread_editedness' => self::EDITED_NEVER), |
814 | 843 | __METHOD__); |
815 | 844 | |
816 | 845 | $newid = $dbr->insertId(); |
Index: trunk/extensions/LiquidThreads/lqt.css |
— | — | @@ -231,11 +231,15 @@ |
232 | 232 | .lqt_nonindent_message { |
233 | 233 | color: #777; |
234 | 234 | font-size: smaller; |
235 | | - float: left; |
236 | 235 | } |
237 | 236 | |
238 | 237 | |
| 238 | +.lqt_edited_notice { |
| 239 | + color: #777; |
| 240 | + font-size: smaller; |
| 241 | +} |
239 | 242 | |
| 243 | + |
240 | 244 | .lqt_header { |
241 | 245 | clear:both; |
242 | 246 | padding-right: 7em; /* so as not to bump into threadlevel_commands. */ |
— | — | @@ -278,22 +282,22 @@ |
279 | 283 | width: 80%; |
280 | 284 | } |
281 | 285 | |
282 | | -.lqt_post .lqt_footer a, .lqt_threadlevel_commands a { |
| 286 | +.lqt_post .lqt_footer a, .lqt_nonindent_message a, .lqt_threadlevel_commands a { |
283 | 287 | color: #5874d1; |
284 | 288 | } |
285 | | -.lqt_post .lqt_footer a:visited, .lqt_threadlevel_commands a:visited { |
| 289 | +.lqt_post .lqt_footer a:visited, .lqt_nonindent_message a:visited, .lqt_threadlevel_commands a:visited { |
286 | 290 | color: #937cba; |
287 | 291 | } |
288 | | -.lqt_post .lqt_footer a:active, .lqt_threadlevel_commands a:active { |
| 292 | +.lqt_post .lqt_footer a:active, .lqt_nonindent_message a:active, .lqt_threadlevel_commands a:active { |
289 | 293 | color: #faa700; |
290 | 294 | } |
291 | | -.lqt_post .lqt_footer a.stub, .lqt_threadlevel_commands a.stub { |
| 295 | +.lqt_post .lqt_footer a.stub, .lqt_nonindent_message a.stub, .lqt_threadlevel_commands a.stub { |
292 | 296 | color: #a66e7a; |
293 | 297 | } |
294 | | -.lqt_post .lqt_footer a.new, #p-personal a.new, .lqt_threadlevel_commands a.new, #p-personal a.new { |
| 298 | +.lqt_post .lqt_footer a.new, #p-personal a.new, .lqt_threadlevel_commands a.new, .lqt_nonindent_message a.new, #p-personal a.new, .lqt_threadlevel_commands a.new, #p-personal a.new { |
295 | 299 | color: #d25858; |
296 | 300 | } |
297 | | -.lqt_post .lqt_footer a.new:visited, #p-personal a.new:visited, .lqt_threadlevel_commands a.new:visited, #p-personal a.new:visited { |
| 301 | +.lqt_post .lqt_footer a.new:visited, #p-personal a.new:visited, .lqt_threadlevel_commands a.new:visited, .lqt_nonindent_message a.new:visited, #p-personal a.new:visited, .lqt_threadlevel_commands a.new:visited, #p-personal a.new:visited { |
298 | 302 | color: #c49292; |
299 | 303 | } |
300 | 304 | |
— | — | @@ -305,27 +309,27 @@ |
306 | 310 | border-color: #aaa; |
307 | 311 | }*/ |
308 | 312 | |
309 | | -.lqt_post .lqt_footer:hover a, .lqt_threadlevel_commands:hover a { |
| 313 | +.lqt_post .lqt_footer:hover a, .lqt_nonindent_message:hover a, .lqt_threadlevel_commands:hover a { |
310 | 314 | color: #002bb8; |
311 | 315 | text-decoration: none; |
312 | 316 | } |
313 | | -.lqt_post .lqt_footer:hover a:visited, .lqt_threadlevel_commands:hover a:visited { |
| 317 | +.lqt_post .lqt_footer:hover a:visited, .lqt_nonindent_message:hover a:visited, .lqt_threadlevel_commands:hover a:visited { |
314 | 318 | color: #5a3696; |
315 | 319 | text-decoration: none; |
316 | 320 | } |
317 | | -.lqt_post .lqt_footer:hover a:active, .lqt_threadlevel_commands:hover a:active { |
| 321 | +.lqt_post .lqt_footer:hover a:active, .lqt_nonindent_message:hover a:active, .lqt_threadlevel_commands:hover a:active { |
318 | 322 | color: #faa700; |
319 | 323 | text-decoration: none; |
320 | 324 | } |
321 | | -.lqt_post .lqt_footer:hover a.stub, .lqt_threadlevel_commands:hover a.stub { |
| 325 | +.lqt_post .lqt_footer:hover a.stub, .lqt_nonindent_message:hover a.stub, .lqt_threadlevel_commands:hover a.stub { |
322 | 326 | color: #772233; |
323 | 327 | text-decoration: none; |
324 | 328 | } |
325 | | -.lqt_post .lqt_footer:hover a.new, #p-personal a.new, .lqt_threadlevel_commands:hover a.new, #p-personal a.new { |
| 329 | +.lqt_post .lqt_footer:hover a.new, #p-personal a.new, .lqt_threadlevel_commands:hover a.new, .lqt_nonindent_message:hover a.new, #p-personal a.new, .lqt_threadlevel_commands:hover a.new, #p-personal a.new { |
326 | 330 | color: #ba0000; |
327 | 331 | text-decoration: none; |
328 | 332 | } |
329 | | -.lqt_post .lqt_footer:hover a.new:visited, #p-personal a.new:visited, .lqt_threadlevel_commands:hover a.new:visited, #p-personal a.new:visited { |
| 333 | +.lqt_post .lqt_footer:hover a.new:visited, #p-personal a.new:visited, .lqt_threadlevel_commands:hover a.new:visited, .lqt_nonindent_message:hover a.new:visited, #p-personal a.new:visited, .lqt_threadlevel_commands:hover a.new:visited, #p-personal a.new:visited { |
330 | 334 | color: #a55858; |
331 | 335 | text-decoration: none; |
332 | 336 | } |
Index: trunk/extensions/LiquidThreads/LqtBaseView.php |
— | — | @@ -719,7 +719,7 @@ |
720 | 720 | ); |
721 | 721 | |
722 | 722 | $this->output->addHTML($this->listItemsForCommands($this->threadFooterCommands($thread))); |
723 | | - |
| 723 | + |
724 | 724 | $this->output->addHTML('</ul>'); |
725 | 725 | } |
726 | 726 | |
— | — | @@ -871,6 +871,13 @@ |
872 | 872 | ) .'</p>'); |
873 | 873 | } |
874 | 874 | |
| 875 | + |
| 876 | + if( $thread->editedness() == Threads::EDITED_BY_AUTHOR ) { |
| 877 | + $this->output->addHTML('<div class="lqt_edited_notice">'.wfMsg('lqt_edited_notice_author').'</div>'); |
| 878 | + } else if($thread->editedness() == Threads::EDITED_BY_OTHERS ) { |
| 879 | + $this->output->addHTML('<div class="lqt_edited_notice">'.wfMsg('lqt_edited_notice_others').'</div>'); |
| 880 | + } |
| 881 | + |
875 | 882 | $this->openDiv('lqt_thread', "lqt_thread_id_{$thread->id()}"); |
876 | 883 | |
877 | 884 | $this->showRootPost( $thread ); |
Index: trunk/extensions/LiquidThreads/README |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | lqt-schema-change-2.sql for before r26550 |
40 | 40 | lqt-schema-change-3.sql for before r26563 |
41 | 41 | lqt-schema-change-4.sql for before r26575 |
| 42 | +lqt-schema-change-5.sql for before r28178 |
42 | 43 | |
43 | 44 | CONTACT: |
44 | 45 | ======= |
Index: trunk/extensions/LiquidThreads/lqt.sql |
— | — | @@ -9,6 +9,8 @@ |
10 | 10 | thread_created char(14) binary NOT NULL default '', |
11 | 11 | thread_revision int(8) unsigned NOT NULL default 1, |
12 | 12 | |
| 13 | + thread_editedness int(1) NOT NULL default 0, |
| 14 | + |
13 | 15 | thread_article_namespace int NOT NULL, |
14 | 16 | thread_article_title varchar(255) binary NOT NULL, |
15 | 17 | |