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

Change subject: Fix: Switch to promise-based citoid requests
......................................................................


Fix: Switch to promise-based citoid requests

Fix for bug where "error" case wasn't running when
citoid service was down.

Converted "always", "success", and "error" into Promise
equivalants "always", "done", and "fail".

Bug: T88897
Change-Id: I8959e09a5fc26fc1322944ed9d1d6878551e2333
---
M modules/ve.ui.CiteFromIDDialog.js
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve.ui.CiteFromIDDialog.js 
b/modules/ve.ui.CiteFromIDDialog.js
index 85c6a4f..0360928 100644
--- a/modules/ve.ui.CiteFromIDDialog.js
+++ b/modules/ve.ui.CiteFromIDDialog.js
@@ -206,11 +206,12 @@
                                                search: encodeURI( 
dialog.searchInput.getValue() ),
                                                format: 
ve.ui.CiteFromIDDialog.static.citoidFormat
                                        },
-                                       dataType: 'json',
-                                       success: function ( result ) {
+                                       dataType: 'json'
+                               } )
+                                       .done( function ( result ) {
                                                dialog.insertTemplate( result );
-                                       },
-                                       error: function ( response, textStatus, 
errorThrown ) {
+                                       } )
+                                       .fail( function ( response, textStatus, 
errorThrown ) {
                                                // 520 status from citoid means 
there was no response at the
                                                // URL provided, but it returns 
a citation regardless. We're
                                                // choosing to insert that 
citation here but to notify the user.
@@ -220,11 +221,10 @@
                                                } else {
                                                        mw.notify( 'Status: '  
+ textStatus +  'Error: ' + errorThrown );
                                                }
-                                       },
-                                       always: function () {
+                                       } )
+                                       .always( function () {
                                                dialog.popPending();
-                                       }
-                               } );
+                                       } );
                        }, this );
                }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8959e09a5fc26fc1322944ed9d1d6878551e2333
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Citoid
Gerrit-Branch: master
Gerrit-Owner: Mvolz <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Mvolz <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to