(fix) keep UID during MOVE

This commit is contained in:
Ludovic Marcotte
2017-02-22 11:35:07 -05:00
parent 3cfbaecbf8
commit 2f56bb43be
+22 -3
View File
@@ -1237,12 +1237,31 @@
- (NSException *) moveToFolder: (SOGoGCSFolder *) newFolder
{
SOGoCalendarComponent *newComponent;
NSException *ex;
id o;
ex = [self copyToFolder: newFolder];
// Lookup to see if the event exists in the target calendar. During a MOVE, we do
// keep the ID of the event intact.
o = [newFolder lookupName: [self nameInContainer]
inContext: context
acquire: NO];
if (!ex)
ex = [self delete];
if ([o isKindOfClass: [NSException class]])
{
newComponent = [[self class] objectWithName: [self nameInContainer]
inContainer: newFolder];
ex = [newComponent saveCalendar: [self calendar: NO secure: NO]];
if (!ex)
ex = [self delete];
}
else
{
ex = [NSException exceptionWithHTTPStatus: 409
reason: @"Target exists - MOVE disallowed."];
}
return ex;
}