Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | $this->perpetuate('lqt_method', 'hidden') . |
243 | 243 | $this->perpetuate('lqt_operand', 'hidden'); |
244 | 244 | |
245 | | - if ( /*$thread == null*/ $edit_type=='new' || ($thread && !$thread->hasSuperthread()) ) { |
| 245 | + if ( $edit_type=='new' || ($thread && !$thread->hasSuperthread()) ) { |
246 | 246 | // This is a top-level post; show the subject line. |
247 | 247 | $sbjtxt = $thread ? $thread->subjectWithoutIncrement() : ''; |
248 | 248 | $subject = $this->request->getVal('lqt_subject_field', $sbjtxt); |
— | — | @@ -268,6 +268,7 @@ |
269 | 269 | if ($edit_type != 'editExisting' && $edit_type != 'summarize' && $e->didSave) { |
270 | 270 | if ( $edit_type == 'reply' ) { |
271 | 271 | $thread = Threads::newThread( $article, $this->article, $edit_applies_to ); |
| 272 | + $edit_applies_to->commitRevision(); |
272 | 273 | } else { |
273 | 274 | $thread = Threads::newThread( $article, $this->article ); |
274 | 275 | } |
— | — | @@ -275,6 +276,7 @@ |
276 | 277 | |
277 | 278 | if ($edit_type == 'summarize' && $e->didSave) { |
278 | 279 | $edit_applies_to->setSummary( $article ); |
| 280 | + $edit_applies_to->commitRevision(); |
279 | 281 | } |
280 | 282 | |
281 | 283 | // Move the thread and replies if subject changed. |
— | — | @@ -287,13 +289,6 @@ |
288 | 290 | $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) ); |
289 | 291 | $thread->commitRevision(); |
290 | 292 | } |
291 | | - |
292 | | -/* $subject = $this->request->getVal('lqt_subject_field', ''); |
293 | | - if ( $e->didSave && $subject != '' ) { |
294 | | - $thread->setSubject( Sanitizer::stripAllTags($subject) ); |
295 | | - } else if ( $e->didSave && $edit_type !='summarize' && $subject == '' && !$thread->hasSuperthread() ) { |
296 | | - $thread->setSubject( '«no subject»' ); |
297 | | - } */ |
298 | 293 | } |
299 | 294 | |
300 | 295 | function renameThread($t,$s) { |
Index: branches/liquidthreads/extensions/LqtModel.php |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | 'thread_article' => $this->articleId, |
210 | 210 | 'thread_path' => $this->path, |
211 | 211 | 'thread_summary_page' => $this->summaryId, |
212 | | - 'thread_timestamp' => $this->timestamp, |
| 212 | + 'thread_timestamp' => wfTimestampNow(), |
213 | 213 | 'thread_revision' => $this->revisionNumber, |
214 | 214 | 'thread_article_namespace' => $this->articleNamespace, |
215 | 215 | 'thread_article_title' => $this->articleTitle), |
— | — | @@ -243,6 +243,29 @@ |
244 | 244 | $this->double->rootRevision = $rev->getId(); |
245 | 245 | } |
246 | 246 | |
| 247 | + /* |
| 248 | + More evidence that the way I'm doing history is totally screwed. |
| 249 | + These methods do not alter the childrens' superthread field. All they do |
| 250 | + is make sure the latest info gets into any historicalthreads we commit. |
| 251 | + */ |
| 252 | + function addReply($thread) { |
| 253 | + $this->replies[] = $thread; |
| 254 | + } |
| 255 | + function removeReplyWithId($id) { |
| 256 | + $target = null; |
| 257 | + foreach($this->replies as $k=>$r) { |
| 258 | + if ($r->id() == $id) { |
| 259 | + $target = $k; break; |
| 260 | + } |
| 261 | + } |
| 262 | + if ($target) { |
| 263 | + unset($this->replies[$target]); |
| 264 | + return true; |
| 265 | + } else { |
| 266 | + return false; |
| 267 | + } |
| 268 | + } |
| 269 | + |
247 | 270 | function setSuperthread($thread) { |
248 | 271 | $this->path = $thread->path . '.' . $this->id; |
249 | 272 | } |
— | — | @@ -393,8 +416,7 @@ |
394 | 417 | |
395 | 418 | if( $superthread ) { |
396 | 419 | $newpath = $superthread->path() . '.' . $newid; |
397 | | - } else |
398 | | - { |
| 420 | + } else { |
399 | 421 | $newpath = $newid; |
400 | 422 | } |
401 | 423 | $res = $dbr->update( 'thread', |
— | — | @@ -403,7 +425,11 @@ |
404 | 426 | __METHOD__); |
405 | 427 | |
406 | 428 | // TODO we could avoid a query here. |
407 | | - return Threads::withId($newid); |
| 429 | + $newthread = Threads::withId($newid); |
| 430 | + if($superthread) { |
| 431 | + $superthread->addReply( $newthread ); |
| 432 | + } |
| 433 | + return $newthread; |
408 | 434 | } |
409 | 435 | |
410 | 436 | static function where( $where, $options = array(), $extra_tables = array() ) { |