From e256446c75148508361f6c9a640133f84f7712d1 Mon Sep 17 00:00:00 2001 From: John Okely Date: Mon, 12 Jun 2017 11:21:38 +0800 Subject: [PATCH 1/2] MDL-58310 message: No longer need to supress errors from messaging --- message/amd/build/message_repository.min.js | 2 +- message/amd/src/message_repository.js | 6 ++---- .../output/popup/amd/build/notification_repository.min.js | 2 +- message/output/popup/amd/src/notification_repository.js | 6 ++---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/message/amd/build/message_repository.min.js b/message/amd/build/message_repository.min.js index bded03758d5..5f20161d194 100644 --- a/message/amd/build/message_repository.min.js +++ b/message/amd/build/message_repository.min.js @@ -1 +1 @@ -define(["jquery","core/ajax","core/notification","core/log"],function(a,b,c,d){var e=function(a){"undefined"==typeof a.limit&&(a.limit=0),"undefined"==typeof a.offset&&(a.offset=0),a.limitfrom=a.offset,a.limitnum=a.limit,delete a.limit,delete a.offset;var d={methodname:"core_message_data_for_messagearea_conversations",args:a},e=b.call([d])[0];return e.fail(c.exception),e},f=function(a){var c={methodname:"core_message_get_unread_conversations_count",args:a},e=b.call([c])[0];return e.fail(function(a){d.error("Could not retrieve unread message count: "+a.message)}),e},g=function(a){var d={methodname:"core_message_mark_all_messages_as_read",args:a},e=b.call([d])[0];return e.fail(c.exception),e};return{query:e,countUnreadConversations:f,markAllAsRead:g}}); \ No newline at end of file +define(["jquery","core/ajax","core/notification"],function(a,b,c){var d=function(a){"undefined"==typeof a.limit&&(a.limit=0),"undefined"==typeof a.offset&&(a.offset=0),a.limitfrom=a.offset,a.limitnum=a.limit,delete a.limit,delete a.offset;var d={methodname:"core_message_data_for_messagearea_conversations",args:a},e=b.call([d])[0];return e.fail(c.exception),e},e=function(a){var d={methodname:"core_message_get_unread_conversations_count",args:a},e=b.call([d])[0];return e.fail(c.exception),e},f=function(a){var d={methodname:"core_message_mark_all_messages_as_read",args:a},e=b.call([d])[0];return e.fail(c.exception),e};return{query:d,countUnreadConversations:e,markAllAsRead:f}}); \ No newline at end of file diff --git a/message/amd/src/message_repository.js b/message/amd/src/message_repository.js index b81eae6043e..6c0ee94f039 100644 --- a/message/amd/src/message_repository.js +++ b/message/amd/src/message_repository.js @@ -22,7 +22,7 @@ * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define(['jquery', 'core/ajax', 'core/notification', 'core/log'], function($, Ajax, Notification, Log) { +define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) { /** * Retrieve a list of messages from the server. * @@ -72,9 +72,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/log'], function($, Aja var promise = Ajax.call([request])[0]; - promise.fail(function(e) { - Log.error('Could not retrieve unread message count: ' + e.message); - }); + promise.fail(Notification.exception); return promise; }; diff --git a/message/output/popup/amd/build/notification_repository.min.js b/message/output/popup/amd/build/notification_repository.min.js index beb592ec1cc..6d076df7bf4 100644 --- a/message/output/popup/amd/build/notification_repository.min.js +++ b/message/output/popup/amd/build/notification_repository.min.js @@ -1 +1 @@ -define(["core/ajax","core/notification","core/log"],function(a,b,c){var d=function(c){"undefined"==typeof c.limit&&(c.limit=20),"undefined"==typeof c.offset&&(c.offset=0);var d={methodname:"message_popup_get_popup_notifications",args:c},e=a.call([d])[0];return e.fail(b.exception),e},e=function(b){var d={methodname:"message_popup_get_unread_popup_notification_count",args:b},e=a.call([d])[0];return e.fail(function(a){c.error("Could not retrieve notifications count: "+a.message)}),e},f=function(c){var d={methodname:"core_message_mark_all_notifications_as_read",args:c},e=a.call([d])[0];return e.fail(b.exception),e},g=function(c,d){var e={messageid:c};d&&(e.timeread=d);var f={methodname:"core_message_mark_message_read",args:e},g=a.call([f])[0];return g.fail(b.exception),g};return{query:d,countUnread:e,markAllAsRead:f,markAsRead:g}}); \ No newline at end of file +define(["core/ajax","core/notification"],function(a,b){var c=function(c){"undefined"==typeof c.limit&&(c.limit=20),"undefined"==typeof c.offset&&(c.offset=0);var d={methodname:"message_popup_get_popup_notifications",args:c},e=a.call([d])[0];return e.fail(b.exception),e},d=function(c){var d={methodname:"message_popup_get_unread_popup_notification_count",args:c},e=a.call([d])[0];return e.fail(b.exception),e},e=function(c){var d={methodname:"core_message_mark_all_notifications_as_read",args:c},e=a.call([d])[0];return e.fail(b.exception),e},f=function(c,d){var e={messageid:c};d&&(e.timeread=d);var f={methodname:"core_message_mark_message_read",args:e},g=a.call([f])[0];return g.fail(b.exception),g};return{query:c,countUnread:d,markAllAsRead:e,markAsRead:f}}); \ No newline at end of file diff --git a/message/output/popup/amd/src/notification_repository.js b/message/output/popup/amd/src/notification_repository.js index 093238a9249..2fdb83ea6d0 100644 --- a/message/output/popup/amd/src/notification_repository.js +++ b/message/output/popup/amd/src/notification_repository.js @@ -22,7 +22,7 @@ * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define(['core/ajax', 'core/notification', 'core/log'], function(Ajax, Notification, Log) { +define(['core/ajax', 'core/notification'], function(Ajax, Notification) { /** * Retrieve a list of notifications from the server. * @@ -64,9 +64,7 @@ define(['core/ajax', 'core/notification', 'core/log'], function(Ajax, Notificati var promise = Ajax.call([request])[0]; - promise.fail(function(e) { - Log.error('Could not retrieve notifications count: ' + e.message); - }); + promise.fail(Notification.exception); return promise; }; From e70d1e66d6516fd5b0fb1d2e5e2283b7cdf0d9ed Mon Sep 17 00:00:00 2001 From: John Okely Date: Mon, 29 May 2017 08:30:24 +0800 Subject: [PATCH 2/2] MDL-58310 ajax: suppress errors upon page unload --- lib/amd/build/ajax.min.js | 2 +- lib/amd/src/ajax.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/amd/build/ajax.min.js b/lib/amd/build/ajax.min.js index 936d338c377..96fcee8fbe6 100644 --- a/lib/amd/build/ajax.min.js +++ b/lib/amd/build/ajax.min.js @@ -1 +1 @@ -define(["jquery","core/config"],function(a,b){var c=function(a){var b,c,d=this,e=null,f=0;for(f=0;f