From 5208e46d100612bff2eb3933db9d7428ae6a9b53 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 28 Oct 2016 11:47:40 -0400 Subject: [PATCH] (js) Fix Resource conflict error handling --- NEWS | 1 + UI/WebServerResources/js/Scheduler/Calendar.service.js | 5 +++-- .../js/Scheduler/CalendarListController.js | 6 +++--- UI/WebServerResources/js/Scheduler/ComponentController.js | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index fe0836e2c..65eb69e4b 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ Bug fixes - [web] improved validation of mail account delegators - [web] fixed auto-completion of list members (#3870) - [web] added missing options to subscribed addressbooks (#3850) + - [web] fixed resource conflict error handling (403 vs 409 HTTP code) - [eas] improve handling of email folders without a parent - [eas] never send IMIP reply when the "initiator" is Outlook 2013/2016 - [core] only consider SMTP addresses for AD's proxyAddresses (#3842) diff --git a/UI/WebServerResources/js/Scheduler/Calendar.service.js b/UI/WebServerResources/js/Scheduler/Calendar.service.js index 8dd0957ac..5e4f7ac63 100644 --- a/UI/WebServerResources/js/Scheduler/Calendar.service.js +++ b/UI/WebServerResources/js/Scheduler/Calendar.service.js @@ -51,8 +51,9 @@ } angular.module('SOGo.SchedulerUI') .value('CalendarSettings', { - EventDragDayLength: 24 * 4, // hour quarters - EventDragHorizontalOffset: 3 // pixels + EventDragDayLength: 24 * 4, // hour quarters + EventDragHorizontalOffset: 3, // pixels + ConflictHTTPErrorCode: 409 }) .factory('Calendar', Calendar.$factory); diff --git a/UI/WebServerResources/js/Scheduler/CalendarListController.js b/UI/WebServerResources/js/Scheduler/CalendarListController.js index 6c909095a..4c5bc8acd 100644 --- a/UI/WebServerResources/js/Scheduler/CalendarListController.js +++ b/UI/WebServerResources/js/Scheduler/CalendarListController.js @@ -6,8 +6,8 @@ /** * @ngInject */ - CalendarListController.$inject = ['$rootScope', '$scope', '$timeout', '$state', '$mdDialog', 'sgHotkeys', 'sgFocus', 'Dialog', 'Preferences', 'Calendar', 'Component']; - function CalendarListController($rootScope, $scope, $timeout, $state, $mdDialog, sgHotkeys, focus, Dialog, Preferences, Calendar, Component) { + CalendarListController.$inject = ['$rootScope', '$scope', '$timeout', '$state', '$mdDialog', 'sgHotkeys', 'sgFocus', 'Dialog', 'Preferences', 'CalendarSettings', 'Calendar', 'Component']; + function CalendarListController($rootScope, $scope, $timeout, $state, $mdDialog, sgHotkeys, focus, Dialog, Preferences, CalendarSettings, Calendar, Component) { var vm = this, hotkeys = []; vm.component = Component; @@ -291,7 +291,7 @@ } function onComponentAdjustError(response, component, params) { - if (response.status == 403 && + if (response.status == CalendarSettings.ConflictHTTPErrorCode && response.data && response.data.message && angular.isObject(response.data.message)) { $mdDialog.show({ parent: angular.element(document.body), diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js index 729c3fc2a..3ef6307a4 100644 --- a/UI/WebServerResources/js/Scheduler/ComponentController.js +++ b/UI/WebServerResources/js/Scheduler/ComponentController.js @@ -209,8 +209,8 @@ /** * @ngInject */ - ComponentEditorController.$inject = ['$rootScope', '$scope', '$log', '$timeout', '$mdDialog', 'User', 'Calendar', 'Component', 'AddressBook', 'Card', 'Alarm', 'stateComponent']; - function ComponentEditorController($rootScope, $scope, $log, $timeout, $mdDialog, User, Calendar, Component, AddressBook, Card, Alarm, stateComponent) { + ComponentEditorController.$inject = ['$rootScope', '$scope', '$log', '$timeout', '$mdDialog', 'User', 'CalendarSettings', 'Calendar', 'Component', 'AddressBook', 'Card', 'Alarm', 'stateComponent']; + function ComponentEditorController($rootScope, $scope, $log, $timeout, $mdDialog, User, CalendarSettings, Calendar, Component, AddressBook, Card, Alarm, stateComponent) { var vm = this, component, oldStartDate, oldEndDate, oldDueDate; vm.service = Calendar; @@ -306,7 +306,7 @@ $mdDialog.hide(); Alarm.getAlarms(); }, function(response) { - if (response.status == 403 && + if (response.status == CalendarSettings.ConflictHTTPErrorCode && response.data && response.data.message && angular.isObject(response.data.message)) vm.attendeeConflictError = response.data.message;