https://bugzilla.wikimedia.org/show_bug.cgi?id=27146

           Summary: Regression? AJAX watch fails when $wgActionPaths used
                    for watch, unwatch
           Product: MediaWiki
           Version: 1.18-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Javascript
        AssignedTo: d...@ucsc.edu
        ReportedBy: br...@pobox.com
                CC: tpars...@wikimedia.org


Tested as of r81491; relevant bit of code was last touched in r78150.

When initializing the AJAX behavior for the watch tab, it seems that current
code tries to divine the target page title from the link URL on the watch tab,
then save that title as extra data associated with the link node:

in mediawiki.action.watch.ajax.js:

        var title = mw.util.getParamValue( 'title', link.href );
        $link.data( 'target', title.replace( /_/g, ' ' ) );

This unfortunately fails when the target link doesn't use a query string
parameter -- mw.util.getParamValue() is unable to find it, and the next line
throws an error:

    title is null
    [Break On This Error] $link.data('target',title.replace(/_/g,' '));

As a result, AJAX watch fails to initialize properly, and the unhandled
exception may also halt initialization of other UI elements.


This code probably doesn't need to be trying to pull a title from the link
manually; it should probably just be using the available wgTitle.


Steps to reproduce:

1) Set some items in $wgActionPaths, say:

  $actions = array('watch', 'unwatch');
  foreach ($actions as $a)  {
         $wgActionPaths[$a] = "$wgScriptPath/action/$a/$1";
  }

2) Set up appropriate rewrite rules or helper scripts to pass
/action/(un)?watch/Foo over to /index.php?action=blah&title=Foo

3) Load up a page view while logged in.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to