jenkins-bot has submitted this change and it was merged.

Change subject: Hygiene: Handle fatal errors when loading talk page
......................................................................


Hygiene: Handle fatal errors when loading talk page

If there is a fatal error from the API when trying to load the talk
page, load it manually instead of just leaving the spinner forever.

Change-Id: Ifd19f20f8cf60efc3cecbb0bc03a25fc9bad606e
---
M javascripts/modules/talk/TalkOverlay.js
1 file changed, 12 insertions(+), 13 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, but someone else must approve
  Awjrichards: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/javascripts/modules/talk/TalkOverlay.js 
b/javascripts/modules/talk/TalkOverlay.js
index 647b3f4..7006dff 100644
--- a/javascripts/modules/talk/TalkOverlay.js
+++ b/javascripts/modules/talk/TalkOverlay.js
@@ -25,21 +25,20 @@
 
                                // FIXME: use Page's mechanisms for retrieving 
page data instead
                                M.pageApi.getPage( options.title ).fail( 
function( resp ) {
-                                       var code;
-                                       if ( resp.error ) {
-                                               code = resp.error.code;
-                                               if ( code === 'missingtitle' ) {
-                                                       // Create an empty page 
for new pages
-                                                       options.page = new 
Page( { title: options.title, sections: [] } );
-                                                       _super.call( self, 
options );
-                                                       self.show();
-                                               // FIXME: [LQT] remove when 
liquid threads is dead (see Bug 51586)
-                                               } else if ( code === 'lqt' ) {
-                                                       // Force a visit to the 
page
-                                                       window.location = 
mw.util.getUrl( options.title );
-                                               }
+                                       // If the API returns the error code 
'missingtitle', that means the
+                                       // talk page doesn't exist yet.
+                                       if ( resp.error.code !== undefined && 
resp.error.code === 'missingtitle' ) {
+                                               // Create an empty page for new 
pages
+                                               options.page = new Page( { 
title: options.title, sections: [] } );
+                                               _super.call( self, options );
+                                               self.show();
+                                       } else {
+                                               // If the API request fails for 
any other reason, load the talk
+                                               // page manually rather than 
leaving the spinner spinning.
+                                               window.location = 
mw.util.getUrl( options.title );
                                        }
                                } ).done( function( pageData ) {
+                                       // API request was successful so show 
the overlay with the talk page content
                                        options.page = new Page( pageData );
                                        _super.call( self, options );
                                        self.show();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd19f20f8cf60efc3cecbb0bc03a25fc9bad606e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <rkald...@wikimedia.org>
Gerrit-Reviewer: Awjrichards <aricha...@wikimedia.org>
Gerrit-Reviewer: JGonera <jgon...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to