Index: trunk/extensions/LiquidThreads/api/ApiThreadAction.php |
— | — | @@ -344,13 +344,24 @@ |
345 | 345 | |
346 | 346 | $articleId = $editResult['edit']['pageid']; |
347 | 347 | |
| 348 | + $article->getTitle()->resetArticleID( $articleId ); |
| 349 | + $title->resetArticleID( $articleId ); |
| 350 | + |
348 | 351 | $thread = LqtView::postEditUpdates( 'new', null, $articleId, $talkpage, |
349 | 352 | $subject, $summary, null, $text ); |
350 | | - |
| 353 | + |
| 354 | + $maxLag = wfGetLB()->getMaxLag(); |
| 355 | + $maxLag = $maxLag[1]; |
| 356 | + |
| 357 | + if ($maxLag == -1) { |
| 358 | + $maxLag = 0; |
| 359 | + } |
| 360 | + |
351 | 361 | $result = array( |
352 | 362 | 'result' => 'Success', |
353 | 363 | 'thread-id' => $thread->id(), |
354 | 364 | 'thread-title' => $title->getPrefixedText(), |
| 365 | + 'max-lag' => $maxLag, |
355 | 366 | ); |
356 | 367 | |
357 | 368 | $result = array( 'thread' => $result ); |
— | — | @@ -431,9 +442,18 @@ |
432 | 443 | } |
433 | 444 | |
434 | 445 | $articleId = $editResult['edit']['pageid']; |
| 446 | + $article->getTitle()->resetArticleID( $articleId ); |
| 447 | + $title->resetArticleID( $articleId ); |
435 | 448 | |
436 | 449 | $thread = LqtView::postEditUpdates( 'reply', $replyTo, $articleId, $talkpage, |
437 | 450 | $subject, $summary, null, $text ); |
| 451 | + |
| 452 | + $maxLag = wfGetLB()->getMaxLag(); |
| 453 | + $maxLag = $maxLag[1]; |
| 454 | + |
| 455 | + if ($maxLag == -1) { |
| 456 | + $maxLag = 0; |
| 457 | + } |
438 | 458 | |
439 | 459 | $result = array( |
440 | 460 | 'action' => 'reply', |
— | — | @@ -444,6 +464,7 @@ |
445 | 465 | 'parent-title' => $replyTo->title()->getPrefixedText(), |
446 | 466 | 'ancestor-id' => $replyTo->topmostThread()->id(), |
447 | 467 | 'ancestor-title' => $replyTo->topmostThread()->title()->getPrefixedText(), |
| 468 | + 'max-lag' => $maxLag, |
448 | 469 | ); |
449 | 470 | |
450 | 471 | $result = array( 'thread' => $result ); |
Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -642,14 +642,17 @@ |
643 | 643 | function() { |
644 | 644 | // Set up thread. |
645 | 645 | liquidThreads.setupThread( $j(this) ); |
| 646 | + |
| 647 | + targetOffset = $j(this).offset().top; |
| 648 | + $j('html,body').animate( |
| 649 | + {scrollTop: targetOffset}, |
| 650 | + 'slow'); |
646 | 651 | } |
647 | 652 | ); |
648 | 653 | }, 'json' ); |
649 | 654 | } |
650 | 655 | |
651 | 656 | var doneCallback = function(data) { |
652 | | - spinner.remove(); |
653 | | - |
654 | 657 | try { |
655 | 658 | var result = data.threadaction.thread.result; |
656 | 659 | } catch ( err ) { |
— | — | @@ -671,13 +674,20 @@ |
672 | 675 | return; |
673 | 676 | } |
674 | 677 | |
| 678 | + var timeout = (data.threadaction.thread['max-lag'] + 1) * 1000; |
| 679 | + var callback; |
| 680 | + |
675 | 681 | if ( type == 'reply' ) { |
676 | | - replyCallback( data ); |
| 682 | + callback = replyCallback; |
677 | 683 | } |
678 | 684 | |
679 | 685 | if ( type == 'talkpage_new_thread' ) { |
680 | | - newCallback( data ); |
| 686 | + callback = newCallback; |
681 | 687 | } |
| 688 | + |
| 689 | + editform.empty().hide(); |
| 690 | + |
| 691 | + setTimeout( function() { spinner.remove(); callback(data); }, timeout ); |
682 | 692 | }; |
683 | 693 | |
684 | 694 | if ( type == 'reply' ) { |