Skip to content

Commit 978b481

Browse files
authored
Merge pull request #23 from nextcloud/issue-18-22-graceful-dying-is-the-new-living
Rest in peaceful silence after a 404 and a 503
2 parents 2b05700 + 2741874 commit 978b481

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

js/app.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
$.ajax({
8282
url: OC.linkToOCS('apps/notifications/api/v1', 2) + 'notifications/' + id + '?format=json',
8383
type: 'DELETE',
84-
success: function(data) {
84+
success: function() {
8585
self._removeNotification(id);
8686
},
8787
error: function() {
@@ -206,12 +206,16 @@
206206
* @param {XMLHttpRequest} xhr
207207
*/
208208
_onFetchError: function(xhr) {
209-
if (xhr.status === 404) {
210-
// 404 Not Found - stop polling
211-
this._shutDownNotifications();
209+
if (xhr.status === 503) {
210+
// 503 - Maintenance mode
211+
console.debug('Shutting down notifications: instance is in maintenance mode.');
212+
} else if (xhr.status === 404) {
213+
// 404 - App disabled
214+
console.debug('Shutting down notifications: app is disabled.');
212215
} else {
213-
OC.Notification.showTemporary('Failed to request notifications. Please try to refresh the page manually.');
216+
console.error('Shutting down notifications: [' + xhr.status + '] ' + xhr.statusText);
214217
}
218+
this._shutDownNotifications();
215219
},
216220

217221
/**

0 commit comments

Comments
 (0)