fix(calendar): send modification notifications for tasks

This commit is contained in:
Francis Lachapelle
2022-02-21 10:42:32 -05:00
parent 4f9601edb2
commit 8a3cb76f0a
2 changed files with 62 additions and 37 deletions

View File

@@ -1,10 +1,6 @@
/* SOGoAptMailReceipt.m - this file is part of SOGo
*
* Copyright (C) 2009-2012 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>
* Copyright (C) 2009-2022 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -206,20 +202,25 @@ static NSCharacterSet *wsSet = nil;
NSCalendarDate *tzDate;
SOGoUser *currentUser;
currentUser = [context activeUser];
if (date)
{
currentUser = [context activeUser];
tzDate = [date copy];
[tzDate setTimeZone: viewTZ];
[tzDate autorelease];
tzDate = [date copy];
[tzDate setTimeZone: viewTZ];
[tzDate autorelease];
formatter = [currentUser dateFormatterInContext: context];
formatter = [currentUser dateFormatterInContext: context];
if ([apt isKindOfClass: [iCalEvent class]] && [(iCalEvent *)apt isAllDay])
return [formatter formattedDate: tzDate];
else
return [NSString stringWithFormat: @"%@ - %@",
[formatter formattedDate: tzDate],
[formatter formattedTime: tzDate]];
if ([apt isKindOfClass: [iCalEvent class]] && [(iCalEvent *)apt isAllDay])
return [formatter formattedDate: tzDate];
else
return [NSString stringWithFormat: @"%@ - %@",
[formatter formattedDate: tzDate],
[formatter formattedTime: tzDate]];
}
return nil;
}
- (NSString *) aptStartDate

View File

@@ -1,6 +1,6 @@
/* SOGoCalendarComponent.m - this file is part of SOGo
*
* Copyright (C) 2006-2021 Inverse inc.
* Copyright (C) 2006-2022 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1308,10 +1308,13 @@
- (NSException *) copyComponent: (iCalCalendar *) calendar
toFolder: (SOGoGCSFolder *) newFolder
{
iCalEvent *event;
iCalEntityObject *component;
SOGoCalendarComponent *newComponent;
SOGoComponentOperation operation;
NSArray *components;
NSException *ex;
operation = EventCreated;
newComponent = [self _copyComponent: calendar
toFolder: newFolder
updateUID: YES];
@@ -1320,12 +1323,21 @@
if (!ex)
{
// Trigger notification in destination folder
event = [[calendar events] objectAtIndex: 0];
[newComponent sendReceiptEmailForObject: event
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: EventCreated];
components = [calendar events];
if ([components count] == 0)
{
components = [calendar todos];
operation = TaskCreated;
}
if ([components count] > 0)
{
component = [components objectAtIndex: 0];
[newComponent sendReceiptEmailForObject: component
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: operation];
}
}
return ex;
@@ -1334,11 +1346,14 @@
- (NSException *) moveToFolder: (SOGoGCSFolder *) newFolder
{
iCalCalendar *calendar;
iCalEvent *event;
iCalEntityObject *component;
SOGoCalendarComponent *newComponent;
SOGoComponentOperation operation;
NSArray *components;
NSException *ex;
calendar = [self calendar: NO secure: NO];
operation = EventCreated;
newComponent = [self _copyComponent: calendar
toFolder: newFolder
updateUID: NO];
@@ -1347,21 +1362,30 @@
if (!ex)
{
// Trigger notification in destination folder
event = [[calendar events] objectAtIndex: 0];
[newComponent sendReceiptEmailForObject: event
components = [calendar events];
if ([components count] == 0)
{
components = [calendar todos];
operation = TaskCreated;
}
if ([components count] > 0)
{
component = [components objectAtIndex: 0];
[newComponent sendReceiptEmailForObject: component
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: operation];
ex = [self delete];
if (!ex)
{
// Trigger notification in source folder
[self sendReceiptEmailForObject: component
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: EventCreated];
ex = [self delete];
if (!ex)
{
// Trigger notification in source folder
[self sendReceiptEmailForObject: event
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: EventDeleted];
operation: operation == EventCreated ? EventDeleted : TaskDeleted];
}
}
}