From 0ba6f655a02932fdf91c25ef39997b90ca5dae36 Mon Sep 17 00:00:00 2001 From: Jorg K Date: Wed, 27 Jul 2016 22:19:23 +0200 Subject: [PATCH] Backed out changeset 2b47a6bef4c7 - push to comm-central instead of try DONTBUILD --- .../content/dialogs/calendar-alarm-dialog.js | 59 ++----------------- calendar/base/public/calIAlarmService.idl | 6 -- calendar/base/src/calAlarmService.js | 8 +-- .../en-US/chrome/calendar/calendar.properties | 4 -- 4 files changed, 10 insertions(+), 67 deletions(-) diff --git a/calendar/base/content/dialogs/calendar-alarm-dialog.js b/calendar/base/content/dialogs/calendar-alarm-dialog.js index ce199d8911..004e92ba47 100644 --- a/calendar/base/content/dialogs/calendar-alarm-dialog.js +++ b/calendar/base/content/dialogs/calendar-alarm-dialog.js @@ -27,11 +27,9 @@ function getAlarmService() { */ function onSnoozeAlarm(event) { // reschedule alarm: - let duration = getDuration(event.detail); - if (aboveSnoozeLimit(duration)) { - // we prevent snoozing too far if the alarm wouldn't be displayed - return; - } + let duration = cal.createDuration(); + duration.minutes = event.detail; + duration.normalize(); getAlarmService().snoozeAlarm(event.target.item, event.target.alarm, duration); } @@ -155,11 +153,9 @@ function updateRelativeDates() { * @param aDurationMinutes The duration in minutes */ function snoozeAllItems(aDurationMinutes) { - let duration = getDuration(aDurationMinutes); - if (aboveSnoozeLimit(duration)) { - // we prevent snoozing too far if the alarm wouldn't be displayed - return; - } + let duration = cal.createDuration(); + duration.minutes = aDurationMinutes; + duration.normalize(); let alarmRichlist = document.getElementById("alarm-richlist"); let parentItems = {}; @@ -176,49 +172,6 @@ function snoozeAllItems(aDurationMinutes) { } } -/** - * Receive a calIDuration object for a given number of minutes - * - * @param {long} aMinutes The number of minutes - * @return {calIDuration} - */ -function getDuration(aMinutes) { - const MINUTESINWEEK = 7 * 24 * 60; - - // converting to weeks if any is required to avoid an integer overflow of duration.minutes as - // this is of type short - let weeks = Math.floor(aMinutes / MINUTESINWEEK); - aMinutes -= weeks * MINUTESINWEEK; - - let duration = cal.createDuration(); - duration.minutes = aMinutes; - duration.weeks = weeks; - duration.normalize(); - return duration; -} - -/** - * Check whether the snooze period exceeds the current limitation of the AlarmService and prompt - * the user with a message if so - * @param {calIDuration} aDuration The duration to snooze - * @returns {Boolean} - */ -function aboveSnoozeLimit(aDuration) { - const LIMIT = Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS; - - let currentTime = cal.now().getInTimezone(cal.UTC()); - let limitTime = currentTime.clone(); - limitTime.month += LIMIT; - - let durationUntilLimit = limitTime.subtractDate(currentTime); - if (aDuration.compare(durationUntilLimit) > 0) { - let msg = PluralForm.get(LIMIT, cal.calGetString("calendar", "alarmSnoozeLimitExceeded")); - showError(msg.replace("#1", LIMIT)); - return true; - } - return false; -} - /** * Sets up the window title, counting the number of alarms in the window. */ diff --git a/calendar/base/public/calIAlarmService.idl b/calendar/base/public/calIAlarmService.idl index adce944cfa..14e1669eee 100644 --- a/calendar/base/public/calIAlarmService.idl +++ b/calendar/base/public/calIAlarmService.idl @@ -44,12 +44,6 @@ interface calIAlarmServiceObserver : nsISupports [scriptable,uuid(42cfa9ce-49d6-11e5-b88c-5b90eedc1c47)] interface calIAlarmService : nsISupports { - /** - * Upper limit for the snooze period for an alarm. To avoid performance issues, don't change this - * to a value larger then 1 at least until bug 861594 or a similar concept is implemented. - */ - const unsigned long MAX_SNOOZE_MONTHS = 1; - /** * This is the timezone that all-day events will be converted to in order to * determine when their alarms should fire. diff --git a/calendar/base/src/calAlarmService.js b/calendar/base/src/calAlarmService.js index 153f8553f0..6fc87b977a 100644 --- a/calendar/base/src/calAlarmService.js +++ b/calendar/base/src/calAlarmService.js @@ -241,14 +241,14 @@ calAlarmService.prototype = { // a month ahead of an event, or doesn't start Lightning // for a month, they'll miss some, but that's a slim chance start = now.clone(); - start.month -= Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS; + start.month -= 1; this.alarmService.mRangeStart = start.clone(); } else { // This is a subsequent search, so we got all the past alarms before start = this.alarmService.mRangeEnd.clone(); } let until = now.clone(); - until.month += Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS; + until.month += 1; // We don't set timers for every future alarm, only those within 6 hours let end = now.clone(); @@ -569,8 +569,8 @@ calAlarmService.prototype = { // for a month, they'll miss some, but that's a slim chance let start = nowUTC(); let until = start.clone(); - start.month -= Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS; - until.month += Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS; + start.month -= 1; + until.month += 1; this.findAlarms(aCalendars, start, until); }, diff --git a/calendar/locales/en-US/chrome/calendar/calendar.properties b/calendar/locales/en-US/chrome/calendar/calendar.properties index 1f192f9c3b..ff90ace78e 100644 --- a/calendar/locales/en-US/chrome/calendar/calendar.properties +++ b/calendar/locales/en-US/chrome/calendar/calendar.properties @@ -450,10 +450,6 @@ alarmYesterdayAt=Yesterday at %1$S alarmDefaultDescription=Default Mozilla Description alarmDefaultSummary=Default Mozilla Summary -# LOCALIZATION NOTE (alarmSnoozeLimitExceeded): Semi-colon list of plural -# forms. -alarmSnoozeLimitExceeded=You cannot snooze an alarm for more than #1 month.;You cannot snooze an alarm for more than #1 months. - taskDetailsStatusNeedsAction=Needs Action # LOCALIZATION NOTE (taskDetailsStatusInProgress):