Last modified: 2012-12-16 17:43:09 UTC
An example where this is a problem: I have two open tabs or windows; I logout in the first, then go to the second one and click "watch". Instead of "you have to be logged in to watch pages", the answer is that the page has been added to the watchlist, while in fact it isn't.
It sounds like this is an issue with checking user authentication or something?
(In reply to comment #1) > It sounds like this is an issue with checking user authentication or something? No, the issue is with the Ajax watch handler's mishandling of failures in the lower-level code that adds a page to a user's watchlist; the authentication is fine, but the code needs to return an appropriate response code or other XML which the client-side code can use to check for an error condition.
That would make this an issue with the response. Would simply adding XML output solve the problem, once a parser was added to the script to look for that output value? Actually, it looks like the watcher script on the server is only returning the operation as a code letter ("<u#>" for unwatch and "<w#>" for watch) followed by the HTML to display on top of the page. Maybe it should have the message watchnologintext returned with a code of "<n#>" or "<f#>" (for "not modified" or "failed") added to the list of possible responses. The script could look for this and display the message like the others, simply changing the ca-watch/ca-unwatch li back to what it had been. Or the server-side script could return different error codes depending on what operation was attempted.
Done in r38527. Would be nice to add a custom message or something.