Index: trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php |
— | — | @@ -61,21 +61,23 @@ |
62 | 62 | 'lqt_hist_merged_from' => 'Reply moved to another thread', |
63 | 63 | 'lqt_hist_merged_to' => 'Reply moved from another thread', |
64 | 64 | 'lqt_hist_split_from' => 'Split to a new thread', |
| 65 | + 'lqt_hist_root_blanked' => 'Removed comment text', |
65 | 66 | |
66 | 67 | 'lqt_revision_as_of' => "Revision as of $2 at $3.", |
67 | 68 | |
68 | 69 | 'lqt_change_new_thread' => 'This is the thread\'s initial revision.', |
69 | | - 'lqt_change_reply_created' => 'The highlighted comment was created in this revision.', |
70 | | - 'lqt_change_edited_root' => 'The highlighted comment was edited in this revision.', |
| 70 | + 'lqt_change_reply_created' => 'The [$1 highlighted comment] was created in this revision.', |
| 71 | + 'lqt_change_edited_root' => 'The [$1 highlighted comment] was edited in this revision.', |
71 | 72 | 'lqt_change_edited_summary' => "The thread's summary was edited", |
72 | | - 'lqt_change_deleted' => 'This thread or a reply to it was deleted', |
73 | | - 'lqt_change_undeleted' => 'The highlighted post was undeleted', |
74 | | - 'lqt_change_moved' => 'This thread was moved to another discussion page', |
75 | | - 'lqt_change_split' => 'This thread was split from another thread', |
| 73 | + 'lqt_change_deleted' => '[$1 This thread] or its parent was deleted', |
| 74 | + 'lqt_change_undeleted' => 'The [$1 highlighted post] was undeleted', |
| 75 | + 'lqt_change_moved' => '[$1 This thread] was moved to another discussion page', |
| 76 | + 'lqt_change_split' => '[$1 This thread] was split from another thread', |
76 | 77 | 'lqt_change_subject_edited' => 'The subject of this thread was changed', |
77 | | - 'lqt_change_merged_from' => 'A reply to this thread was moved to another thread', |
78 | | - 'lqt_change_merged_to' => 'The highlighted reply was moved from another thread', |
79 | | - 'lqt_change_split_from' => 'A subthread of this thread was split into its own thread', |
| 78 | + 'lqt_change_merged_from' => 'A [$1 reply] to this thread was moved to another thread', |
| 79 | + 'lqt_change_merged_to' => 'The [$1 highlighted reply] was moved from another thread', |
| 80 | + 'lqt_change_split_from' => 'A [$1 subthread] of this thread was split into its own thread', |
| 81 | + 'lqt_change_root_blanked' => 'The text of [$1 a comment] was removed.', |
80 | 82 | |
81 | 83 | 'lqt_youhavenewmessages' => 'You have [$1 new messages].', |
82 | 84 | 'lqt_protectedfromreply' => 'This thread has been $1 from being replied to.', |
Index: trunk/extensions/LiquidThreads/classes/Threads.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | const CHANGE_MERGED_FROM = 10; |
24 | 24 | const CHANGE_MERGED_TO = 11; |
25 | 25 | const CHANGE_SPLIT_FROM = 12; |
| 26 | + const CHANGE_ROOT_BLANKED = 13; |
26 | 27 | |
27 | 28 | static $VALID_CHANGE_TYPES = array( |
28 | 29 | self::CHANGE_EDITED_SUMMARY, |
— | — | @@ -37,6 +38,7 @@ |
38 | 39 | self::CHANGE_MERGED_FROM, |
39 | 40 | self::CHANGE_MERGED_TO, |
40 | 41 | self::CHANGE_SPLIT_FROM, |
| 42 | + self::CHANGE_ROOT_BLANKED, |
41 | 43 | ); |
42 | 44 | |
43 | 45 | // Possible values of Thread->editedness. |
Index: trunk/extensions/LiquidThreads/classes/View.php |
— | — | @@ -107,9 +107,46 @@ |
108 | 108 | return $sk->link( $title, $text, $attribs, $query ); |
109 | 109 | } |
110 | 110 | |
| 111 | + static function linkInContextData( $thread, $contextType = 'page' ) { |
| 112 | + $query = array(); |
| 113 | + |
| 114 | + if ( $contextType == 'page' ) { |
| 115 | + $title = clone $thread->article()->getTitle(); |
| 116 | + |
| 117 | + $dbr = wfGetDB( DB_SLAVE ); |
| 118 | + $offset = $thread->topmostThread()->sortkey(); |
| 119 | + $offset = wfTimestamp( TS_UNIX, $offset ) + 1; |
| 120 | + $offset = $dbr->timestamp( $offset ); |
| 121 | + $query['offset'] = $offset; |
| 122 | + } else { |
| 123 | + $title = clone $thread->title(); |
| 124 | + } |
| 125 | + |
| 126 | + $query['lqt_mustshow'] = $thread->id(); |
| 127 | + |
| 128 | + $title->setFragment( '#'.$thread->getAnchorName() ); |
| 129 | + |
| 130 | + return array( $title, $query ); |
| 131 | + } |
| 132 | + |
| 133 | + static function linkInContext( $thread, $contextType = 'page', $text = null ) { |
| 134 | + list( $title, $query ) = self::linkInContextData( $thread, $contextType ); |
| 135 | + |
| 136 | + global $wgUser; |
| 137 | + $sk = $wgUser->getSkin(); |
| 138 | + |
| 139 | + return $sk->link( $title, $text, array(), $query ); |
| 140 | + } |
| 141 | + |
| 142 | + static function linkInContextURL( $thread, $contextType = 'page' ) { |
| 143 | + list( $title, $query ) = self::linkInContextData( $thread, $contextType ); |
| 144 | + |
| 145 | + return $title->getFullURL( $query ); |
| 146 | + } |
| 147 | + |
111 | 148 | static function diffQuery( $thread, $revision ) { |
112 | 149 | $changed_thread = $revision->getChangeObject(); |
113 | | - $curr_rev_id = $revision->getThreadObj()->rootRevision(); |
| 150 | + $curr_rev_id = $changed_thread->rootRevision(); |
114 | 151 | $curr_rev = Revision::newFromId( $curr_rev_id ); |
115 | 152 | $prev_rev = $curr_rev->getPrevious(); |
116 | 153 | $oldid = $prev_rev ? $prev_rev->getId() : ""; |
— | — | @@ -424,7 +461,8 @@ |
425 | 462 | if ( $e->didSave ) { |
426 | 463 | $thread = self::postEditUpdates( |
427 | 464 | $edit_type, $edit_applies_to, $article, |
428 | | - $this->article, $subject, $e->summary, $thread |
| 465 | + $this->article, $subject, $e->summary, $thread, |
| 466 | + $e->textbox1 |
429 | 467 | ); |
430 | 468 | } |
431 | 469 | |
— | — | @@ -444,7 +482,7 @@ |
445 | 483 | } |
446 | 484 | |
447 | 485 | static function postEditUpdates( $edit_type, $edit_applies_to, $edit_page, $article, |
448 | | - $subject, $edit_summary, $thread ) { |
| 486 | + $subject, $edit_summary, $thread, $new_text ) { |
449 | 487 | // Update metadata - create and update thread and thread revision objects as |
450 | 488 | // appropriate. |
451 | 489 | |
— | — | @@ -466,8 +504,13 @@ |
467 | 505 | // $this->renameThread( $thread, $subject, $e->summary ); |
468 | 506 | } |
469 | 507 | |
| 508 | + // Use a separate type if the content is blanked. |
| 509 | + $type = strlen( trim( $new_text ) ) |
| 510 | + ? Threads::CHANGE_EDITED_ROOT |
| 511 | + : Threads::CHANGE_ROOT_BLANKED; |
| 512 | + |
470 | 513 | // Add the history entry. |
471 | | - $thread->commitRevision( Threads::CHANGE_EDITED_ROOT, $thread, $edit_summary ); |
| 514 | + $thread->commitRevision( $type, $thread, $edit_summary ); |
472 | 515 | } else { |
473 | 516 | $thread = Threads::newThread( $edit_page, $article, null, |
474 | 517 | Threads::TYPE_NORMAL, $subject ); |
— | — | @@ -1077,11 +1120,19 @@ |
1078 | 1121 | } |
1079 | 1122 | |
1080 | 1123 | function getMustShowThreads( $threads = array() ) { |
1081 | | - if ( $this->request->getVal( 'lqt_operand' ) ) { |
| 1124 | + if ( $this->request->getCheck( 'lqt_operand' ) ) { |
1082 | 1125 | $operands = explode( ',', $this->request->getVal( 'lqt_operand' ) ); |
1083 | 1126 | $threads = array_merge( $threads, $operands ); |
1084 | 1127 | } |
1085 | 1128 | |
| 1129 | + if ( $this->request->getCheck( 'lqt_mustshow' ) ) { |
| 1130 | + // Check for must-show in the request |
| 1131 | + $specifiedMustShow = $this->request->getVal( 'lqt_mustshow' ); |
| 1132 | + $specifiedMustShow = explode( ',', $specifiedMustShow ); |
| 1133 | + |
| 1134 | + $threads = array_merge( $threads, $specifiedMustShow ); |
| 1135 | + } |
| 1136 | + |
1086 | 1137 | foreach ( $threads as $walk_thread ) { |
1087 | 1138 | do { |
1088 | 1139 | if ( !is_object( $walk_thread ) ) { |
Index: trunk/extensions/LiquidThreads/classes/Hooks.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | // Make sure it points to the right page. The Pager seems to use the DB |
51 | 51 | // representation of a timestamp for its offset field, odd. |
52 | 52 | $dbr = wfGetDB( DB_SLAVE ); |
53 | | - $offset = wfTimestamp( TS_UNIX, $thread->topmostThread()->modified() ) + 1; |
| 53 | + $offset = wfTimestamp( TS_UNIX, $thread->topmostThread()->sortkey() ) + 1; |
54 | 54 | $offset = $dbr->timestamp( $offset ); |
55 | 55 | |
56 | 56 | $thread_link = $changeslist->skin->link( $tmp_title, |
Index: trunk/extensions/LiquidThreads/classes/ThreadRevision.php |
— | — | @@ -4,17 +4,17 @@ |
5 | 5 | class ThreadRevision { |
6 | 6 | static $load = |
7 | 7 | array( |
8 | | - 'th_id' => 'mId', |
9 | | - 'th_thread' => 'mThreadId', |
| 8 | + 'th_id' => 'mId', |
| 9 | + 'th_thread' => 'mThreadId', |
10 | 10 | |
11 | 11 | 'th_timestamp' => 'mTimestamp', |
12 | 12 | |
13 | | - 'th_user' => 'mUserId', |
| 13 | + 'th_user' => 'mUserId', |
14 | 14 | 'th_user_text' => 'mUserText', |
15 | 15 | |
16 | 16 | 'th_change_type' => 'mChangeType', |
17 | 17 | 'th_change_object' => 'mChangeObjectId', |
18 | | - 'th_change_comment' => 'mChangeComment', |
| 18 | + 'th_change_comment' => 'mChangeComment', |
19 | 19 | 'th_content' => 'mObjSer', |
20 | 20 | ); |
21 | 21 | |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | static function create( $thread, $change_type, $change_object = null, $comment = '', |
46 | | - $user = null, $timestamp = null ) { |
| 46 | + $user = null, $timestamp = null ) { |
47 | 47 | if ( is_null( $user ) ) { |
48 | 48 | global $wgUser; |
49 | 49 | $user = $wgUser; |
— | — | @@ -134,7 +134,13 @@ |
135 | 135 | |
136 | 136 | function getChangeObject() { |
137 | 137 | if ( !$this->mChangeObject && $this->mChangeObjectId ) { |
138 | | - $this->mChangeObject = Threads::withId( $this->mChangeObjectId ); |
| 138 | + $threadObj = $this->getThreadObj(); |
| 139 | + $objectId = $this->mChangeObjectId; |
| 140 | + $this->mChangeObject = $threadObj->replyWithId( $objectId ); |
| 141 | + |
| 142 | + if ( !$this->mChangeObject ) { |
| 143 | + $this->mChangeObject = Threads::withId( $objectId ); |
| 144 | + } |
139 | 145 | } |
140 | 146 | |
141 | 147 | return $this->mChangeObject; |
Index: trunk/extensions/LiquidThreads/classes/Thread.php |
— | — | @@ -1219,4 +1219,18 @@ |
1220 | 1220 | |
1221 | 1221 | $this->sortkey = $k; |
1222 | 1222 | } |
| 1223 | + |
| 1224 | + function replyWithId( $id ) { |
| 1225 | + if ( $this->id() == $id ) { |
| 1226 | + return $this; |
| 1227 | + } |
| 1228 | + |
| 1229 | + foreach( $this->replies() as $reply ) { |
| 1230 | + if ( $obj = $reply->replyWithId($id) ) { |
| 1231 | + return $obj; |
| 1232 | + } |
| 1233 | + } |
| 1234 | + |
| 1235 | + return null; |
| 1236 | + } |
1223 | 1237 | } |
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php |
— | — | @@ -35,6 +35,8 @@ |
36 | 36 | Threads::CHANGE_MERGED_TO => 'lqt_change_merged_to', |
37 | 37 | Threads::CHANGE_SPLIT_FROM => 'lqt_change_split_from', |
38 | 38 | Threads::CHANGE_EDITED_SUMMARY => 'lqt_change_edited_summary', |
| 39 | + Threads::CHANGE_ROOT_BLANKED => 'lqt_change_root_blanked', |
| 40 | + Threads::CHANGE_EDITED_ROOT => 'lqt_change_edited_root', |
39 | 41 | ); |
40 | 42 | |
41 | 43 | if ( isset( $messages[$ct] ) ) { |
— | — | @@ -62,14 +64,25 @@ |
63 | 65 | $ct = $this->mDisplayRevision->getChangeType(); |
64 | 66 | |
65 | 67 | $msg = ''; |
66 | | - if ( $ct == Threads::CHANGE_EDITED_ROOT ) { |
67 | | - $diff_link = $this->diffPermalink( $this->thread, |
| 68 | + |
| 69 | + $post = $this->mDisplayRevision->getChangeObject(); |
| 70 | + $postLinkURL = LqtView::linkInContextURL( $post ); |
| 71 | + |
| 72 | + $msg = $this->getMessageForChangeType( $ct ); |
| 73 | + |
| 74 | + if ( $ct == Threads::CHANGE_EDITED_ROOT || |
| 75 | + $ct == Threads::CHANGE_ROOT_BLANKED ) { |
| 76 | + $diff_link = $this->diffPermalink( $post, |
68 | 77 | wfMsgExt( 'diff', 'parseinline' ), |
69 | 78 | $this->mDisplayRevision ); |
70 | | - $msg = wfMsgExt( 'lqt_change_edited_root', 'parseinline' ) . |
| 79 | + |
| 80 | + $msg = wfMsgExt( $msg, |
| 81 | + array( 'parseinline' ), |
| 82 | + array( $postLinkURL ) ) . |
71 | 83 | " [$diff_link]"; |
72 | | - } else { |
73 | | - $msg = wfMsgExt( $this->getMessageForChangeType( $ct ), 'parseinline' ); |
| 84 | + } else { |
| 85 | + $msg = wfMsgExt( $msg, array( 'parseinline' ), |
| 86 | + array( $postLinkURL ) ); |
74 | 87 | } |
75 | 88 | |
76 | 89 | $html .= $msg; |
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php |
— | — | @@ -46,20 +46,21 @@ |
47 | 47 | $this->view = $view; |
48 | 48 | |
49 | 49 | self::$change_names = |
50 | | - array( |
51 | | - Threads::CHANGE_EDITED_ROOT => wfMsgNoTrans( 'lqt_hist_comment_edited' ), |
52 | | - Threads::CHANGE_EDITED_SUMMARY => wfMsgNoTrans( 'lqt_hist_summary_changed' ), |
53 | | - Threads::CHANGE_REPLY_CREATED => wfMsgNoTrans( 'lqt_hist_reply_created' ), |
54 | | - Threads::CHANGE_NEW_THREAD => wfMsgNoTrans( 'lqt_hist_thread_created' ), |
55 | | - Threads::CHANGE_DELETED => wfMsgNoTrans( 'lqt_hist_deleted' ), |
56 | | - Threads::CHANGE_UNDELETED => wfMsgNoTrans( 'lqt_hist_undeleted' ), |
57 | | - Threads::CHANGE_MOVED_TALKPAGE => wfMsgNoTrans( 'lqt_hist_moved_talkpage' ), |
58 | | - Threads::CHANGE_EDITED_SUBJECT => wfMsgNoTrans( 'lqt_hist_edited_subject' ), |
59 | | - Threads::CHANGE_SPLIT => wfMsgNoTrans( 'lqt_hist_split' ), |
60 | | - Threads::CHANGE_MERGED_FROM => wfMsgNoTrans( 'lqt_hist_merged_from' ), |
61 | | - Threads::CHANGE_MERGED_TO => wfMsgNoTrans( 'lqt_hist_merged_to' ), |
62 | | - Threads::CHANGE_SPLIT_FROM => wfMsgNoTrans( 'lqt_hist_split_from' ), |
63 | | - ); |
| 50 | + array( |
| 51 | + Threads::CHANGE_EDITED_ROOT => wfMsgNoTrans( 'lqt_hist_comment_edited' ), |
| 52 | + Threads::CHANGE_EDITED_SUMMARY => wfMsgNoTrans( 'lqt_hist_summary_changed' ), |
| 53 | + Threads::CHANGE_REPLY_CREATED => wfMsgNoTrans( 'lqt_hist_reply_created' ), |
| 54 | + Threads::CHANGE_NEW_THREAD => wfMsgNoTrans( 'lqt_hist_thread_created' ), |
| 55 | + Threads::CHANGE_DELETED => wfMsgNoTrans( 'lqt_hist_deleted' ), |
| 56 | + Threads::CHANGE_UNDELETED => wfMsgNoTrans( 'lqt_hist_undeleted' ), |
| 57 | + Threads::CHANGE_MOVED_TALKPAGE => wfMsgNoTrans( 'lqt_hist_moved_talkpage' ), |
| 58 | + Threads::CHANGE_EDITED_SUBJECT => wfMsgNoTrans( 'lqt_hist_edited_subject' ), |
| 59 | + Threads::CHANGE_SPLIT => wfMsgNoTrans( 'lqt_hist_split' ), |
| 60 | + Threads::CHANGE_MERGED_FROM => wfMsgNoTrans( 'lqt_hist_merged_from' ), |
| 61 | + Threads::CHANGE_MERGED_TO => wfMsgNoTrans( 'lqt_hist_merged_to' ), |
| 62 | + Threads::CHANGE_SPLIT_FROM => wfMsgNoTrans( 'lqt_hist_split_from' ), |
| 63 | + Threads::CHANGE_ROOT_BLANKED => wfMsgNoTrans( 'lqt_hist_root_blanked' ), |
| 64 | + ); |
64 | 65 | } |
65 | 66 | |
66 | 67 | function getQueryInfo() { |