Index: branches/wmf-deployment/extensions/LiquidThreads/classes/View.php |
— | — | @@ -170,14 +170,30 @@ |
171 | 171 | return array( $title, $query ); |
172 | 172 | } |
173 | 173 | |
| 174 | + /* If you want $perpetuateOffset to perpetuate from a specific request, pass that instead |
| 175 | + of true */ |
174 | 176 | static function talkpageUrl( $title, $method = null, $operand = null, |
175 | | - $includeFragment = true ) { |
| 177 | + $includeFragment = true, $perpetuateOffset = true ) { |
176 | 178 | global $wgUser; |
177 | 179 | $sk = $wgUser->getSkin(); |
178 | 180 | |
179 | 181 | list( $title, $query ) = |
180 | 182 | self::talkpageLinkData( $title, $method, $operand, $includeFragment ); |
181 | 183 | |
| 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 | + |
182 | 198 | return $title->getLinkUrl( $query ); |
183 | 199 | } |
184 | 200 | |
— | — | @@ -326,12 +342,21 @@ |
327 | 343 | global $wgRequest; |
328 | 344 | $wgRequest->setVal( 'wpPreview', true ); |
329 | 345 | } |
| 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 = ''; |
330 | 354 | |
331 | 355 | $e->suppressIntro = true; |
332 | 356 | $e->editFormTextBeforeContent .= |
333 | 357 | $this->perpetuate( 'lqt_method', 'hidden' ) . |
334 | 358 | $this->perpetuate( 'lqt_operand', 'hidden' ) . |
335 | | - Xml::hidden( 'lqt_nonce', wfGenerateToken() ); |
| 359 | + Xml::hidden( 'lqt_nonce', wfGenerateToken() ) . |
| 360 | + Xml::hidden( 'offset', $offset ); |
336 | 361 | |
337 | 362 | // Add a one-time random string to a hidden field. Store the random string |
338 | 363 | // in memcached on submit and don't allow the edit to go ahead if it's already |
— | — | @@ -493,7 +518,8 @@ |
494 | 519 | $editMsg = $user_can_edit ? 'edit' : 'viewsource'; |
495 | 520 | |
496 | 521 | $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 ), |
498 | 524 | 'enabled' => true ); |
499 | 525 | |
500 | 526 | $history_url = self::permalinkUrlWithQuery( $thread, array( 'action' => 'history' ) ); |
— | — | @@ -557,7 +583,8 @@ |
558 | 584 | } |
559 | 585 | |
560 | 586 | $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), |
562 | 589 | 'enabled' => true, 'icon' => 'reply.png', 'showlabel' => 1, |
563 | 590 | 'tooltip' => wfMsg( 'lqt_reply' ) ); |
564 | 591 | |
— | — | @@ -568,7 +595,8 @@ |
569 | 596 | |
570 | 597 | if ( $thread->root()->getTitle()->quickUserCan( 'edit' ) ) { |
571 | 598 | $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 ), |
573 | 601 | 'enabled' => true, 'icon' => 'edit.png', |
574 | 602 | 'tooltip' => wfMsgExt( 'edit', 'parseinline' ) ); |
575 | 603 | } |
Property changes on: branches/wmf-deployment/extensions/LiquidThreads |
___________________________________________________________________ |
Name: svn:mergeinfo |
576 | 604 | - /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 |
577 | 605 | + /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 |