r60205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60204‎ | r60205 | r60206 >
Date:13:49, 18 December 2009
Author:werdna
Status:resolved (Comments)
Tags:
Comment:
LiquidThreads (SCHEMA CHANGE): Make signatures a per-post affair, defaulting to the user's signature, but editable in the process of editing a post, and indeed variable on a per-post basis.
Modified paths:
  • /trunk/extensions/LiquidThreads/api/ApiThreadAction.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Hooks.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Thread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php
@@ -271,6 +271,8 @@
272272 'lqt-drag-save' => 'Confirm',
273273 'lqt-drag-reason' => 'Reason:',
274274 'lqt-drag-subject' => 'Subject for new thread:',
 275+ 'lqt-edit-signature' => '(edit signature)',
 276+ 'lqt-preview-signature' => '(preview)',
275277
276278 // Feeds
277279 'lqt-feed-title-all' => '{{SITENAME}} — New posts',
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -27,9 +27,6 @@
2828 protected $sort_order = LQT_NEWEST_CHANGES;
2929
3030 static $stylesAndScriptsDone = false;
31 -
32 - static $userSignatureCache = array();
33 - static $boringSignatureCache = array();
3431
3532 function __construct( &$output, &$article, &$title, &$user, &$request ) {
3633 $this->article = $article;
@@ -460,10 +457,32 @@
461458 Xml::hidden( 'lqt_nonce', wfGenerateToken() ) .
462459 Xml::hidden( 'offset', $offset );
463460
 461+ $signatureText = $this->request->getVal( 'wpLqtSignature', null );
 462+
 463+ if ( is_null($signatureText) ) {
 464+ if ( !$thread && $edit_type != 'summarize' ) {
 465+ $signatureText = LqtView::getUserSignature( $this->user );
 466+ } else {
 467+ $signatureText = $thread->signature();
 468+ }
 469+ }
 470+
 471+ $signatureHTML = LqtView::parseSignature( $signatureText );
 472+
 473+ // Signature edit box
 474+ $signaturePreview = Xml::tags( 'span',
 475+ array( 'class' => 'lqt-signature-preview',
 476+ 'style' => 'display: none;' ),
 477+ $signatureHTML );
 478+ $signatureEditBox = Xml::input( 'wpLqtSignature', 45, $signatureText,
 479+ array( 'class' => 'lqt-signature-edit' ) );
 480+
 481+ $signatureEditor = $signaturePreview . $signatureEditBox;
 482+
464483 $e->editFormTextAfterContent .=
465 - Xml::tags( 'p', null, $this->getSignature( $this->user ) );
 484+ $signatureEditor;
466485 $e->previewTextAfterContent .=
467 - Xml::tags( 'p', null, $this->getSignature( $this->user ) );
 486+ Xml::tags( 'p', null, $signatureHTML );
468487
469488 // Add a one-time random string to a hidden field. Store the random string
470489 // in memcached on submit and don't allow the edit to go ahead if it's already
@@ -517,7 +536,7 @@
518537 $thread = self::postEditUpdates(
519538 $edit_type, $edit_applies_to, $article,
520539 $this->article, $subject, $e->summary, $thread,
521 - $e->textbox1, $bump
 540+ $e->textbox1, $bump, $signatureText
522541 );
523542
524543 if ( $submitted_nonce && $nonce_key ) {
@@ -542,16 +561,23 @@
543562
544563 static function postEditUpdates( $edit_type, $edit_applies_to, $edit_page, $article,
545564 $subject, $edit_summary, $thread, $new_text,
546 - $bump = null ) {
 565+ $bump = null, $signature = null ) {
547566 // Update metadata - create and update thread and thread revision objects as
548567 // appropriate.
 568+
 569+ $noSignature = false;
 570+ if ( is_null($signature) ) {
 571+ global $wgUser;
 572+ $signature = LqtView::getUserSignature( $wgUser );
 573+ $noSignature = true;
 574+ }
549575
550576 if ( $edit_type == 'reply' ) {
551577 $subject = $edit_applies_to->subject();
552578
553579 $thread = Thread::create( $edit_page, $article, $edit_applies_to,
554580 Threads::TYPE_NORMAL, $subject,
555 - $edit_summary, $bump );
 581+ $edit_summary, $bump, $signature );
556582
557583 global $wgUser;
558584 NewMessages::markThreadAsReadByUser( $edit_applies_to, $wgUser );
@@ -566,12 +592,16 @@
567593 ? Threads::CHANGE_EDITED_ROOT
568594 : Threads::CHANGE_ROOT_BLANKED;
569595
 596+ if ( $signature && !$noSignature ) {
 597+ $thread->setSignature( $signature );
 598+ }
 599+
570600 // Add the history entry.
571601 $thread->commitRevision( $type, $thread, $edit_summary, $bump );
572602 } else {
573603 $thread = Thread::create( $edit_page, $article, null,
574604 Threads::TYPE_NORMAL, $subject,
575 - $edit_summary );
 605+ $edit_summary, null, $signature );
576606 }
577607
578608 return $thread;
@@ -865,6 +895,8 @@
866896 'lqt-drag-save',
867897 'lqt-drag-reason',
868898 'lqt-drag-subject',
 899+ 'lqt-edit-signature',
 900+ 'lqt-preview-signature',
869901 );
870902
871903 $data = array();
@@ -1042,9 +1074,9 @@
10431075 global $wgUser, $wgLang;
10441076 $sk = $wgUser->getSkin();
10451077
1046 - $author = $thread->author();
1047 -
1048 - $signature = $this->getSignature( $author );
 1078+ $signature = $thread->signature();
 1079+ $signature = LqtView::parseSignature( $signature );
 1080+
10491081 $signature = Xml::tags( 'span', array( 'class' => 'lqt-thread-user-signature' ),
10501082 $signature );
10511083
@@ -1643,29 +1675,40 @@
16441676 }
16451677 }
16461678
1647 - function getBoringSignature( $user, $uid, $name ) {
1648 - if ( isset( self::$boringSignatureCache[$name] ) ) {
1649 - return self::$boringSignatureCache[$name];
 1679+ static function getUserSignature( $user, $uid = null ) {
 1680+ global $wgParser, $wgOut, $wgTitle;
 1681+ if ( !$user ) {
 1682+ $user = User::newFromId( $uid );
16501683 }
16511684
1652 - $msg = ( $uid > 0 ) ? 'signature' : 'signature-anon';
 1685+ $sig = $wgParser->getUserSig( $user );
16531686
1654 - $sig = wfMsgExt( $msg, 'parseinline', array( $name, $name ) );
1655 -
1656 - self::$boringSignatureCache[$name] = $sig;
1657 -
16581687 return $sig;
16591688 }
16601689
1661 - function getUserSignature( $user, $uid, $name ) {
1662 - if ( isset( self::$userSignatureCache[$name] ) ) {
1663 - return self::$userSignatureCache[$name];
1664 - }
 1690+ static function parseSignature( $sig ) {
 1691+ global $wgParser, $wgOut, $wgTitle;
16651692
1666 - if ( !$user ) {
1667 - $user = User::newFromId( $uid );
 1693+ static $parseCache = array();
 1694+ $sigKey = md5($sig);
 1695+
 1696+ if ( isset( $parseCache[$sigKey] ) ) {
 1697+ return $parseCache[$sigKey];
16681698 }
16691699
 1700+ // Parser gets antsy about parser options here if it hasn't parsed anything before.
 1701+ $wgParser->clearState();
 1702+ $wgParser->setTitle( $wgTitle );
 1703+ $wgParser->mOptions = new ParserOptions;
 1704+
 1705+ $sig = $wgOut->parseInline( $sig );
 1706+
 1707+ $parseCache[$sigKey] = $sig;
 1708+
 1709+ return $sig;
 1710+ }
 1711+
 1712+ static function signaturePST( $sig, $user ) {
16701713 global $wgParser, $wgOut, $wgTitle;
16711714
16721715 // Parser gets antsy about parser options here if it hasn't parsed anything before.
@@ -1673,13 +1716,9 @@
16741717 $wgParser->setTitle( $wgTitle );
16751718 $wgParser->mOptions = new ParserOptions;
16761719
1677 - $sig = $wgParser->getUserSig( $user );
1678 - $sig = $wgParser->preSaveTransform( $sig, $this->title, $user,
 1720+ $sig = $wgParser->preSaveTransform( $sig, $wgTitle, $user,
16791721 $wgParser->mOptions, false );
1680 - $sig = $wgOut->parseInline( $sig );
16811722
1682 - self::$userSignatureCache[$name] = $sig;
1683 -
16841723 return $sig;
16851724 }
16861725
Index: trunk/extensions/LiquidThreads/classes/Hooks.php
@@ -7,81 +7,7 @@
88 public static $editAppliesTo = null;
99 public static $editArticle = null;
1010 public static $editTalkpage = null;
11 -
12 - static function customizeOldChangesList( &$changeslist, &$s, $rc ) {
13 - if ( $rc->getTitle()->getNamespace() != NS_LQT_THREAD )
14 - return true;
15 -
16 - $thread = Threads::withRoot( new Article( $rc->getTitle() ) );
17 - if ( !$thread ) return true;
1811
19 - LqtView::addJSandCSS();
20 - wfLoadExtensionMessages( 'LiquidThreads' );
21 -
22 - if ( $rc->mAttribs['rc_new'] ) {
23 - global $wgOut;
24 -
25 - $sig = "";
26 - $changeslist->insertUserRelatedLinks( $sig, $rc );
27 -
28 - // This should be stored in RC.
29 - $rev = Revision::newFromId( $rc->mAttribs['rc_this_oldid'] );
30 - $quote = $rev->getText();
31 - $link = '';
32 - if ( strlen( $quote ) > 230 ) {
33 - $sk = $changeslist->skin;
34 - $quote = substr( $quote, 0, 200 );
35 - $link = $sk->link( $thread->title(), wfMsg( 'lqt_rc_ellipsis' ),
36 - array( 'class' => 'lqt_rc_ellipsis' ), array(), array( 'known' ) );
37 - }
38 -
39 - $quote = htmlspecialchars( $quote ) . $link;
40 -
41 - if ( $thread->isTopmostThread() ) {
42 - $message_name = 'lqt_rc_new_discussion';
43 - } else {
44 - $message_name = 'lqt_rc_new_reply';
45 - }
46 -
47 - $tmp_title = $thread->article()->getTitle();
48 - $tmp_title->setFragment( '#' . LqtView::anchorName( $thread ) );
49 -
50 - // Make sure it points to the right page. The Pager seems to use the DB
51 - // representation of a timestamp for its offset field, odd.
52 - $dbr = wfGetDB( DB_SLAVE );
53 - $offset = wfTimestamp( TS_UNIX, $thread->topmostThread()->sortkey() ) + 1;
54 - $offset = $dbr->timestamp( $offset );
55 -
56 - $thread_link = $changeslist->skin->link( $tmp_title,
57 - htmlspecialchars( $thread->subjectWithoutIncrement() ),
58 - array(), array( 'offset' => $offset ), array( 'known' ) );
59 -
60 - $talkpage_link = $changeslist->skin->link(
61 - $thread->article()->getTitle(),
62 - null,
63 - array(), array(), array( 'known' ) );
64 -
65 - $s = wfMsg( $message_name, $thread_link, $talkpage_link, $sig )
66 - . Xml::tags( 'blockquote', array( 'class' => 'lqt_rc_blockquote' ), $quote );
67 -
68 - $classes = array();
69 - $changeslist->insertTags( $s, $rc, $classes );
70 - $changeslist->insertExtra( $s, $rc, $classes );
71 - } else {
72 - // Add whether it was original author.
73 - if ( $thread->author()->getName() != $rc->mAttribs['rc_user_text'] ) {
74 - $appendix = Xml::tags( 'span',
75 - array( 'class' => 'lqt_rc_author_notice ' .
76 - 'lqt_rc_author_notice_others' ),
77 - wfMsgExt( 'lqt_rc_author_others', 'parseinline' )
78 - );
79 -
80 - $s .= ' ' . $appendix;
81 - }
82 - }
83 - return true;
84 - }
85 -
8612 static function setNewtalkHTML( $skintemplate, $tpl ) {
8713 global $wgUser, $wgTitle, $wgOut;
8814
@@ -147,14 +73,6 @@
14874 global $wgEnableEmail;
14975 wfLoadExtensionMessages( 'LiquidThreads' );
15076
151 - // Whether or not to show user signatures
152 - $preferences['lqtcustomsignatures'] =
153 - array(
154 - 'type' => 'toggle',
155 - 'label-message' => 'lqt-preference-custom-signatures',
156 - 'section' => 'lqt',
157 - );
158 -
15977 if ( $wgEnableEmail ) {
16078 $preferences['lqtnotifytalk'] =
16179 array(
@@ -351,7 +269,6 @@
352270 $wgExtNewTables[] = array( 'user_message_state', "$dir/lqt.sql" );
353271 $wgExtNewTables[] = array( 'thread_history', "$dir/schema-changes/thread_history_table.sql" );
354272
355 -
356273 $wgExtNewFields[] = array( "thread", "thread_article_namespace", "$dir/schema-changes/split-thread_article.sql" );
357274 $wgExtNewFields[] = array( "thread", "thread_article_title", "$dir/schema-changes/split-thread_article.sql" );
358275 $wgExtNewFields[] = array( "thread", "thread_ancestor", "$dir/schema-changes/normalise-ancestry.sql" );
@@ -365,6 +282,7 @@
366283 $wgExtNewFields[] = array( "thread", "thread_sortkey", "$dir/schema-changes/new-sortkey.sql" );
367284 $wgExtNewFields[] = array( 'thread', 'thread_replies', "$dir/schema-changes/store_reply_count.sql" );
368285 $wgExtNewFields[] = array( 'thread', 'thread_article_id', "$dir/schema-changes/store_article_id.sql" );
 286+ $wgExtNewFields[] = array( 'thread', 'thread_signature', "$dir/schema-changes/thread_signature.sql" );
369287
370288 $wgExtNewIndexes[] = array( 'thread', 'thread_summary_page', '(thread_summary_page)' );
371289
Index: trunk/extensions/LiquidThreads/classes/Thread.php
@@ -32,6 +32,7 @@
3333 protected $subject;
3434 protected $authorId;
3535 protected $authorName;
 36+ protected $signature;
3637
3738 protected $allDataLoaded;
3839
@@ -56,7 +57,7 @@
5758
5859 static function create( $root, $article, $superthread = null,
5960 $type = Threads::TYPE_NORMAL, $subject = '',
60 - $summary = '', $bump = null ) {
 61+ $summary = '', $bump = null, $signature = null ) {
6162
6263 $dbw = wfGetDB( DB_MASTER );
6364
@@ -87,6 +88,10 @@
8889 $thread->setSubject( $subject );
8990 $thread->setType( $type );
9091
 92+ if ( !is_null($signature) ) {
 93+ $thread->setSignature( $signature );
 94+ }
 95+
9196 $thread->insert();
9297
9398 if ( $superthread ) {
@@ -242,6 +247,7 @@
243248 'thread_editedness' => $this->editedness,
244249 'thread_sortkey' => $this->sortkey,
245250 'thread_replies' => $this->replyCount,
 251+ 'thread_signature' => $this->signature,
246252 );
247253 }
248254
@@ -439,6 +445,7 @@
440446 'thread_author_name' => 'authorName',
441447 'thread_sortkey' => 'sortkey',
442448 'thread_replies' => 'replyCount',
 449+ 'thread_signature' => 'signature',
443450 );
444451
445452 foreach ( $dataLoads as $db_field => $member_field ) {
@@ -582,64 +589,6 @@
583590
584591 $userIds = array_keys( $userIds );
585592
586 - // Pull signature data and pre-cache in View object.
587 - if ( count( $userIds ) ) {
588 - $signatureDataCache = array_fill_keys( $userIds, array() );
589 - $res = $dbr->select( 'user_properties',
590 - array( 'up_user', 'up_property', 'up_value' ),
591 - array( 'up_property' => array( 'nickname', 'fancysig' ),
592 - 'up_user' => $userIds ),
593 - __METHOD__ );
594 -
595 - foreach ( $res as $row ) {
596 - $signatureDataCache[$row->up_user][$row->up_property] = $row->up_value;
597 - }
598 -
599 - global $wgParser, $wgOut, $wgTitle;
600 -
601 - $setTitle = false;
602 - if ( !$wgOut->getTitle() ) {
603 - $setTitle = true;
604 - }
605 -
606 - // Parser gets antsy about parser options here if it hasn't parsed anything before.
607 - $wgParser->clearState();
608 - $wgParser->setTitle( $wgTitle );
609 - $wgParser->mOptions = new ParserOptions;
610 -
611 - foreach ( $userIds as $uid ) {
612 - $user = User::newFromId( $uid ); // Should pull from UID cache.
613 - $name = $user->getName();
614 -
615 - // Grab sig data
616 - $nickname = null;
617 - $fancysig = (bool)User::getDefaultOption( 'fancysig' );
618 -
619 - if ( isset( $signatureDataCache[$uid]['nickname'] ) )
620 - $nickname = $signatureDataCache[$uid]['nickname'];
621 - if ( isset( $signatureDataCache[$uid]['fancysig'] ) )
622 - $fancysig = $signatureDataCache[$uid]['fancysig'];
623 -
624 - // Generate signature from Parser
625 -
626 - if ( $setTitle ) {
627 - $user_t = Title::makeTitleSafe( NS_USER, $name );
628 - $wgOut->setTitle( $user_t );
629 - }
630 -
631 - $title = Title::newFromText( 'Main Page' );
632 -
633 - $sig = $wgParser->preSaveTransform( $nickname, $title,
634 - $user, $wgParser->mOptions,
635 - false );
636 - $sig = $wgParser->getUserSig( $user, $nickname, $fancysig );
637 - $sig = $wgOut->parseInline( $sig );
638 -
639 - // Save into LqtView for later use.
640 - LqtView::$userSignatureCache[$name] = $sig;
641 - }
642 - }
643 -
644593 // Pull link batch data.
645594 $linkBatch->execute();
646595
@@ -823,6 +772,16 @@
824773 Threads::synchroniseArticleData( $this->article, 100, 'cascade' );
825774 }
826775
 776+ // Check for unfilled signature field. This field hasn't existed until
 777+ // recently.
 778+ if ( is_null( $this->signature ) ) {
 779+ // Grab our signature.
 780+ $sig = LqtView::getUserSignature( $this->author() );
 781+
 782+ $set['thread_signature'] = $sig;
 783+ $this->setSignature( $sig );
 784+ }
 785+
827786 if ( count( $set ) ) {
828787 $dbw = wfGetDB( DB_MASTER );
829788
@@ -1438,4 +1397,13 @@
14391398
14401399 return true;
14411400 }
 1401+
 1402+ public function signature() {
 1403+ return $this->signature;
 1404+ }
 1405+
 1406+ public function setSignature($sig) {
 1407+ $sig = LqtView::signaturePST( $sig, $this->author() );
 1408+ $this->signature = $sig;
 1409+ }
14421410 }
Index: trunk/extensions/LiquidThreads/lqt.sql
@@ -25,6 +25,9 @@
2626
2727 -- Reply count, -1 means uninitialised.
2828 thread_replies int(8) DEFAULT -1,
 29+
 30+ -- Signature
 31+ thread_signature TINYBLOB NULL,
2932
3033 PRIMARY KEY thread_id (thread_id),
3134 UNIQUE INDEX thread_root_page (thread_root),
Index: trunk/extensions/LiquidThreads/api/ApiThreadAction.php
@@ -39,6 +39,8 @@
4040 'sortkey' => "Specifies the timestamp to which to set a thread's ".
4141 "sort key. Must be in the form YYYYMMddhhmmss, ".
4242 "a unix timestamp or 'now'.",
 43+ 'signature' => 'Specifies the signature to use for that post. Can be '.
 44+ 'NULL to specify the default signature',
4345 );
4446 }
4547
@@ -65,6 +67,7 @@
6668 'render' => null,
6769 'bump' => null,
6870 'sortkey' => null,
 71+ 'signature' => null,
6972 );
7073 }
7174
@@ -341,6 +344,11 @@
342345 $summary = $params['reason'];
343346 }
344347
 348+ $signature = null;
 349+ if ( isset( $params['signature'] ) ) {
 350+ $signature = $params['signature'];
 351+ }
 352+
345353 // Inform hooks what we're doing
346354 LqtHooks::$editTalkpage = $talkpage;
347355 LqtHooks::$editArticle = $article;
@@ -379,7 +387,7 @@
380388 $title->resetArticleID( $articleId );
381389
382390 $thread = LqtView::postEditUpdates( 'new', null, $article, $talkpage,
383 - $subject, $summary, null, $text, $bump );
 391+ $subject, $summary, null, $text, $bump, $signature );
384392
385393 $maxLag = wfGetLB()->getMaxLag();
386394 $maxLag = $maxLag[1];
@@ -446,6 +454,11 @@
447455 $summary = $params['reason'];
448456 }
449457
 458+ $signature = null;
 459+ if ( isset( $params['signature'] ) ) {
 460+ $signature = $params['signature'];
 461+ }
 462+
450463 // Grab data from parent
451464 $talkpage = $replyTo->article();
452465 $subject = $replyTo->subject();
@@ -492,7 +505,7 @@
493506 $title->resetArticleID( $articleId );
494507
495508 $thread = LqtView::postEditUpdates( 'reply', $replyTo, $article, $talkpage,
496 - $subject, $summary, null, $text, $bump );
 509+ $subject, $summary, null, $text, $bump, $signature );
497510
498511 $maxLag = wfGetLB()->getMaxLag();
499512 $maxLag = $maxLag[1];
Index: trunk/extensions/LiquidThreads/lqt.js
@@ -125,6 +125,16 @@
126126 $j(container).find('#wpTextbox1').focus();//.autogrow();
127127 // Focus the subject field if there is one. Overrides previous line.
128128 $j(container).find('#lqt_subject_field').focus();
 129+
 130+ // Update signature editor
 131+ $j(container).find('input[name=wpLqtSignature]').hide();
 132+ $j(container).find('.lqt-signature-preview').show();
 133+ var editLink = $j('<a class="lqt-signature-edit-button"/>' );
 134+ editLink.text( wgLqtMessages['lqt-edit-signature'] );
 135+ editLink.click( liquidThreads.handleEditSignature );
 136+ editLink.attr('href', '#');
 137+ $j(container).find('.lqt-signature-preview').after(editLink);
 138+ editLink.before(' ');
129139 }
130140
131141 var finishSetup = function() {
@@ -158,7 +168,7 @@
159169 // Check for live preview
160170 if ( $j('#wpLivePreview').length ) {
161171 $j.getScript( stylepath+'/common/preview.js',
162 - function() { setupLivePreview(); } );
 172+ function() { setupLivePreview(); } );
163173 }
164174 };
165175
@@ -845,12 +855,20 @@
846856 },
847857
848858 'handleAJAXSave' : function( e ) {
 859+ e.preventDefault();
849860 var editform = $j(this).closest('.lqt-edit-form');
850861 var type = editform.find('input[name=lqt_method]').val();
851862
852863 var text = editform.find('#wpTextbox1').val();
853864 var summary = editform.find('#wpSummary').val();
854865
 866+ var signature;
 867+ if ( editform.find('input[name=wpLqtSignature]').length ) {
 868+ signature = editform.find('input[name=wpLqtSignature]').val();
 869+ } else {
 870+ signature = undefined
 871+ }
 872+
855873 // Check if summary is undefined
856874 if (summary === undefined) {
857875 summary = '';
@@ -963,12 +981,12 @@
964982
965983 if ( type == 'reply' ) {
966984 liquidThreads.doReply( replyThread, text, summary,
967 - doneCallback, bump );
 985+ doneCallback, bump, signature );
968986
969987 e.preventDefault();
970988 } else if ( type == 'talkpage_new_thread' ) {
971989 liquidThreads.doNewThread( wgPageName, subject, text, summary,
972 - doneCallback, bump );
 990+ doneCallback, bump, signature );
973991
974992 e.preventDefault();
975993 }
@@ -985,7 +1003,7 @@
9861004 } );
9871005 },
9881006
989 - 'doNewThread' : function( talkpage, subject, text, summary, callback, bump ) {
 1007+ 'doNewThread' : function( talkpage, subject, text, summary, callback, bump, signature ) {
9901008 liquidThreads.getToken(
9911009 function(token) {
9921010 var newTopicParams =
@@ -1002,6 +1020,10 @@
10031021 'bump' : bump
10041022 };
10051023
 1024+ if ( typeof signature != 'undefined' ) {
 1025+ newTopicParams.signature = signature;
 1026+ }
 1027+
10061028 $j.post( wgScriptPath+'/api'+wgScriptExtension, newTopicParams,
10071029 function(data) {
10081030 if (callback) {
@@ -1011,7 +1033,7 @@
10121034 } );
10131035 },
10141036
1015 - 'doReply' : function( thread, text, summary, callback, bump ) {
 1037+ 'doReply' : function( thread, text, summary, callback, bump, signature ) {
10161038 liquidThreads.getToken(
10171039 function(token) {
10181040 var replyParams =
@@ -1027,6 +1049,10 @@
10281050 'bump' : bump
10291051 };
10301052
 1053+ if ( typeof signature != 'undefined' ) {
 1054+ replyParams.signature = signature;
 1055+ }
 1056+
10311057 $j.post( wgScriptPath+'/api'+wgScriptExtension, replyParams,
10321058 function(data) {
10331059 if (callback) {
@@ -1459,6 +1485,60 @@
14601486
14611487 liquidThreads.apiRequest( apiRequest, doneCallback );
14621488 }
 1489+ },
 1490+
 1491+ 'handleEditSignature' : function(e) {
 1492+ e.preventDefault();
 1493+
 1494+ var container = $j(this).parent();
 1495+
 1496+ container.find('.lqt-signature-preview').hide();
 1497+ container.find('input[name=wpLqtSignature]').show();
 1498+ $j(this).hide();
 1499+
 1500+ // Add a save button
 1501+ var saveButton = $j('<a href="#"/>');
 1502+ saveButton.text( wgLqtMessages['lqt-preview-signature'] );
 1503+ saveButton.click( liquidThreads.handlePreviewSignature );
 1504+
 1505+ container.find('input[name=wpLqtSignature]').after(saveButton);
 1506+ },
 1507+
 1508+ 'handlePreviewSignature' : function(e) {
 1509+ e.preventDefault();
 1510+
 1511+ var container = $j(this).parent();
 1512+
 1513+ var spinner = $j('<span class="mw-small-spinner"/>');
 1514+ $j(this).replaceWith(spinner);
 1515+
 1516+ var textbox = container.find('input[name=wpLqtSignature]');
 1517+ var preview = container.find('.lqt-signature-preview');
 1518+
 1519+ textbox.hide();
 1520+ var text = textbox.val();
 1521+
 1522+ var apiReq =
 1523+ {
 1524+ 'action' : 'parse',
 1525+ 'text' : text,
 1526+ 'pst' : '1',
 1527+ 'prop' : 'text'
 1528+ };
 1529+
 1530+ liquidThreads.apiRequest( function() { return apiReq; },
 1531+ function(data) {
 1532+ var html = $j(data.parse.text['*'].trim());
 1533+
 1534+ if (html.length == 2) { // Not 1, because of the NewPP report
 1535+ html = html.contents();
 1536+ }
 1537+
 1538+ preview.empty().append(html);
 1539+ preview.show();
 1540+ spinner.remove();
 1541+ container.find('.lqt-signature-edit-button').show();
 1542+ } );
14631543 }
14641544 }
14651545

Comments

#Comment by Raymond (talk | contribs)   22:06, 19 December 2009

Seen at translatewiki:

PHP Fatal error: Call to a member function getCleanSignatures() on a non-object in /var/www/w/includes/parser/Parser.php on line 4086

#Comment by 😂 (talk | contribs)   19:26, 27 January 2010

Is this fixed?

#Comment by Siebrand (talk | contribs)   20:47, 27 January 2010

No longer observed on r61595. Unsure if it was a core change that fixed it or one of Andrew's recent changes. We've been reverting to a known more stable version at twn until just a few hours ago. Setting to new.

Status & tagging log