(fix) avoid duplicating attendees when accepting event using a different identity over CalDAV
Conflicts: SoObjects/Appointments/iCalEntityObject+SOGo.h
This commit is contained in:
parent
544cb85e4d
commit
cfb741fc9f
1
NEWS
1
NEWS
|
@ -14,6 +14,7 @@ Bug fixes
|
||||||
- EAS fix on qp-encoded subjects (#3390)
|
- EAS fix on qp-encoded subjects (#3390)
|
||||||
- correctly handle all-day event exceptions when the master event changes
|
- correctly handle all-day event exceptions when the master event changes
|
||||||
- prevent characters in calendar component UID causing issues during import process
|
- prevent characters in calendar component UID causing issues during import process
|
||||||
|
- avoid duplicating attendees when accepting event using a different identity over CalDAV
|
||||||
|
|
||||||
2.3.3a (2015-11-18)
|
2.3.3a (2015-11-18)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
|
@ -2174,7 +2174,31 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
iCalPerson *attendee, *delegate;
|
iCalPerson *attendee, *delegate;
|
||||||
NSString *delegateEmail;
|
NSString *delegateEmail;
|
||||||
|
|
||||||
attendee = [newEvent userAsAttendee: [SOGoUser userWithLogin: owner]];
|
attendee = [oldEvent userAsAttendee: [SOGoUser userWithLogin: owner]];
|
||||||
|
|
||||||
|
if (!attendee)
|
||||||
|
[newEvent userAsAttendee: [SOGoUser userWithLogin: owner]];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We must do an extra check here since Bob could have invited Alice
|
||||||
|
// using alice@example.com but she would have accepted with ATTENDEE set
|
||||||
|
// to sexy@example.com. That would duplicate the ATTENDEE and set the
|
||||||
|
// participation status to ACCEPTED for sexy@example.com but leave it
|
||||||
|
// to NEEDS-ACTION to alice@example. This can happen in Mozilla Thunderbird/Lightning
|
||||||
|
// when a user with multiple identities accepts an event invitation to one
|
||||||
|
// of its identity (which is different than the email address associated with
|
||||||
|
// the mail account) prior doing a calendar refresh.
|
||||||
|
NSMutableArray *attendees;
|
||||||
|
NSString *partStat;
|
||||||
|
|
||||||
|
attendees = [NSMutableArray arrayWithArray: [newEvent attendeesWithoutUser: [SOGoUser userWithLogin: owner]]];
|
||||||
|
|
||||||
|
partStat = [newEvent participationStatusForUser: [SOGoUser userWithLogin: owner]
|
||||||
|
attendee: attendee];
|
||||||
|
[attendee setPartStat: partStat];
|
||||||
|
[attendees addObject: attendee];
|
||||||
|
[newEvent setAttendees: attendees];
|
||||||
|
}
|
||||||
|
|
||||||
// We first check of the sequences are alright. We don't accept attendees
|
// We first check of the sequences are alright. We don't accept attendees
|
||||||
// accepting "old" invitations. If that's the case, we return a 403
|
// accepting "old" invitations. If that's the case, we return a 403
|
||||||
|
|
|
@ -44,6 +44,9 @@ extern NSNumber *iCalDistantFutureNumber;
|
||||||
|
|
||||||
- (iCalPerson *) userAsAttendee: (SOGoUser *) user;
|
- (iCalPerson *) userAsAttendee: (SOGoUser *) user;
|
||||||
|
|
||||||
|
- (NSString *) participationStatusForUser: (SOGoUser *) theUser
|
||||||
|
attendee: (iCalPerson *) theAttendee;
|
||||||
|
- (NSArray *) attendeeUIDs;
|
||||||
- (BOOL) isStillRelevant;
|
- (BOOL) isStillRelevant;
|
||||||
|
|
||||||
- (id) itipEntryWithMethod: (NSString *) method;
|
- (id) itipEntryWithMethod: (NSString *) method;
|
||||||
|
|
|
@ -422,8 +422,8 @@ NSNumber *iCalDistantFutureNumber = nil;
|
||||||
|
|
||||||
- (iCalPerson *) userAsAttendee: (SOGoUser *) user
|
- (iCalPerson *) userAsAttendee: (SOGoUser *) user
|
||||||
{
|
{
|
||||||
NSEnumerator *attendees;
|
|
||||||
iCalPerson *currentAttendee, *userAttendee;
|
iCalPerson *currentAttendee, *userAttendee;
|
||||||
|
NSEnumerator *attendees;
|
||||||
|
|
||||||
userAttendee = nil;
|
userAttendee = nil;
|
||||||
|
|
||||||
|
@ -436,6 +436,34 @@ NSNumber *iCalDistantFutureNumber = nil;
|
||||||
return userAttendee;
|
return userAttendee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) participationStatusForUser: (SOGoUser *) theUser
|
||||||
|
attendee: (iCalPerson *) theAttendee
|
||||||
|
{
|
||||||
|
iCalPerson *currentAttendee;
|
||||||
|
NSEnumerator *attendees;
|
||||||
|
NSMutableArray *a;
|
||||||
|
|
||||||
|
a = [NSMutableArray array];
|
||||||
|
|
||||||
|
attendees = [[self attendees] objectEnumerator];
|
||||||
|
while ((currentAttendee = [attendees nextObject]))
|
||||||
|
if ([theUser hasEmail: [currentAttendee rfc822Email]])
|
||||||
|
{
|
||||||
|
// If the attendee is the same but the partStat is
|
||||||
|
// different, we prioritize this one.
|
||||||
|
if ([[currentAttendee rfc822Email] caseInsensitiveCompare: [theAttendee rfc822Email]] == NSOrderedSame &&
|
||||||
|
[[currentAttendee partStat] caseInsensitiveCompare: [theAttendee partStat]] != NSOrderedSame)
|
||||||
|
[a insertObject: currentAttendee atIndex: 0];
|
||||||
|
else if ([[currentAttendee rfc822Email] caseInsensitiveCompare: [theAttendee rfc822Email]] != NSOrderedSame)
|
||||||
|
[a addObject: currentAttendee];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([a count] > 0)
|
||||||
|
return [[a objectAtIndex: 0] partStat];
|
||||||
|
|
||||||
|
return [theAttendee partStat];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) userIsOrganizer: (SOGoUser *) user
|
- (BOOL) userIsOrganizer: (SOGoUser *) user
|
||||||
{
|
{
|
||||||
NSString *mail;
|
NSString *mail;
|
||||||
|
|
Loading…
Reference in a new issue