Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72544


Change subject: mw.ViewPageTarget: Don't bind edit section links on non-view 
page
......................................................................

mw.ViewPageTarget: Don't bind edit section links on non-view page

The handler for the Edit tab already is in this conditional,
for edit section we were making the assumption that they only
ever appear on a view page, but that's wrong. They're also shown
on a diff against the latest revision of the page.

Bug: 50925
Change-Id: I802e548cbcdc03cfca66129466668854604bc3e7
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/44/72544/1

diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
index 575436c..d970375 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
@@ -247,7 +247,14 @@
                                // Events
                                $heading.on( { 'mouseenter': expandSoon, 
'mouseleave': shrinkSoon } );
                                $links.on( { 'focus': expand, 'blur': 
shrinkSoon } );
-                               $editLink.click( init.onEditSectionLinkClick );
+                               if ( isViewPage ) {
+                                       // Only init without refresh if we're 
on a view page. Though section edit links
+                                       // are rarely shown on non-view pages, 
they appear in one other case, namely
+                                       // when on a diff against the latest 
version of a page. In that case we musn't
+                                       // init without refresh as that'd 
initialise for the wrong rev id (bug 50925)
+                                       // and would preserve the wrong DOM 
with a diff on top.
+                                       $editLink.click( 
init.onEditSectionLinkClick );
+                               }
 
                                // Initialization
                                $editSourceLink

-- 
To view, visit https://gerrit.wikimedia.org/r/72544
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I802e548cbcdc03cfca66129466668854604bc3e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to