diff --git a/src/store/calendarObjectInstance.js b/src/store/calendarObjectInstance.js index 49ed0a81b6..fedfc768fb 100644 --- a/src/store/calendarObjectInstance.js +++ b/src/store/calendarObjectInstance.js @@ -45,6 +45,8 @@ import { } from '../utils/color.js' import { mapAlarmComponentToAlarmObject } from '../models/alarm.js' import { getObjectAtRecurrenceId } from '../utils/calendarObject.js' +import logger from '../utils/logger.js' +import settings from './settings.js' const state = { isNew: null, @@ -1430,6 +1432,18 @@ const actions = { const eventComponent = getObjectAtRecurrenceId(calendarObject, startDate) const calendarObjectInstance = mapEventComponentToEventObject(eventComponent) + // Add an alarm if the user set a default one in the settings. If + // not, defaultReminder will not be a number (rather the string "none"). + const defaultReminder = parseInt(settings.state.defaultReminder) + if (!isNaN(defaultReminder)) { + commit('addAlarmToCalendarObjectInstance', { + calendarObjectInstance: calendarObjectInstance, + type: 'DISPLAY', + totalSeconds: defaultReminder, + }) + logger.debug(`Added defaultReminder (${defaultReminder}s) to newly created event`) + } + commit('setCalendarObjectInstanceForNewEvent', { calendarObject, calendarObjectInstance,