r57399 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57398‎ | r57399 | r57400 >
Date:20:06, 5 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
Merge r57379, perpetuation of offset parameter in links and form parameters
Modified paths:
  • /branches/wmf-deployment/extensions/LiquidThreads (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/classes/View.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/LiquidThreads/classes/View.php
@@ -170,14 +170,30 @@
171171 return array( $title, $query );
172172 }
173173
 174+ /* If you want $perpetuateOffset to perpetuate from a specific request, pass that instead
 175+ of true */
174176 static function talkpageUrl( $title, $method = null, $operand = null,
175 - $includeFragment = true ) {
 177+ $includeFragment = true, $perpetuateOffset = true ) {
176178 global $wgUser;
177179 $sk = $wgUser->getSkin();
178180
179181 list( $title, $query ) =
180182 self::talkpageLinkData( $title, $method, $operand, $includeFragment );
181183
 184+ $request = $perpetuateOffset;
 185+ if ($request === true) {
 186+ global $wgRequest;
 187+ $request = $wgRequest;
 188+ }
 189+
 190+ if ( $perpetuateOffset ) {
 191+ $offset = $request->getVal( 'offset' );
 192+
 193+ if ($offset) {
 194+ $query['offset'] = $offset;
 195+ }
 196+ }
 197+
182198 return $title->getLinkUrl( $query );
183199 }
184200
@@ -326,12 +342,21 @@
327343 global $wgRequest;
328344 $wgRequest->setVal( 'wpPreview', true );
329345 }
 346+
 347+ // Add an offset so it works if it's on the wrong page.
 348+ if ( $edit_applies_to ) {
 349+ $dbr = wfGetDB( DB_SLAVE );
 350+ $offset = wfTimestamp( TS_UNIX, $edit_applies_to->topmostThread()->modified() );
 351+ $offset++;
 352+ $offset = $dbr->timestamp( $offset );
 353+ } else $offset = '';
330354
331355 $e->suppressIntro = true;
332356 $e->editFormTextBeforeContent .=
333357 $this->perpetuate( 'lqt_method', 'hidden' ) .
334358 $this->perpetuate( 'lqt_operand', 'hidden' ) .
335 - Xml::hidden( 'lqt_nonce', wfGenerateToken() );
 359+ Xml::hidden( 'lqt_nonce', wfGenerateToken() ) .
 360+ Xml::hidden( 'offset', $offset );
336361
337362 // Add a one-time random string to a hidden field. Store the random string
338363 // in memcached on submit and don't allow the edit to go ahead if it's already
@@ -493,7 +518,8 @@
494519 $editMsg = $user_can_edit ? 'edit' : 'viewsource';
495520
496521 $commands['edit'] = array( 'label' => wfMsgExt( $editMsg, 'parseinline' ),
497 - 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ),
 522+ 'href' => $this->talkpageUrl( $this->title, 'edit', $thread,
 523+ true /* include fragment */ , $this->request ),
498524 'enabled' => true );
499525
500526 $history_url = self::permalinkUrlWithQuery( $thread, array( 'action' => 'history' ) );
@@ -557,7 +583,8 @@
558584 }
559585
560586 $commands['reply'] = array( 'label' => wfMsgExt( 'lqt_reply', 'parseinline' ),
561 - 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ),
 587+ 'href' => $this->talkpageUrl( $this->title, 'reply', $thread,
 588+ true /* include fragment */, $this->request),
562589 'enabled' => true, 'icon' => 'reply.png', 'showlabel' => 1,
563590 'tooltip' => wfMsg( 'lqt_reply' ) );
564591
@@ -568,7 +595,8 @@
569596
570597 if ( $thread->root()->getTitle()->quickUserCan( 'edit' ) ) {
571598 $commands['edit'] = array( 'label' => wfMsgExt( 'edit', 'parseinline' ),
572 - 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ),
 599+ 'href' => $this->talkpageUrl( $this->title, 'edit', $thread,
 600+ true /* include fragment */, $this->request ),
573601 'enabled' => true, 'icon' => 'edit.png',
574602 'tooltip' => wfMsgExt( 'edit', 'parseinline' ) );
575603 }
Property changes on: branches/wmf-deployment/extensions/LiquidThreads
___________________________________________________________________
Name: svn:mergeinfo
576604 - /branches/REL1_15/phase3/extensions/LiquidThreads:51646
/trunk/extensions/LiquidThreads:56151-57116,57130-57134,57169,57193,57195,57198,57200-57206,57215,57219,57222,57225,57227,57229,57287,57384,57389-57390
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350
577605 + /branches/REL1_15/phase3/extensions/LiquidThreads:51646
/trunk/extensions/LiquidThreads:56151-57116,57130-57134,57169,57193,57195,57198,57200-57206,57215,57219,57222,57225,57227,57229,57287,57379,57384,57389-57390
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57379LiquidThreads: perpetuate offset parameter in edit and reply links, and in th...werdna13:26, 5 October 2009

Status & tagging log