oc-folder: simplify lookupFolder method

use activate and no need to set wocontext, it's already set properly
This commit is contained in:
Jesús García Sáez 2015-07-14 17:19:55 +02:00
parent 68ae978b13
commit 393b6d5128

View file

@ -231,30 +231,19 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
- (id) lookupFolder: (NSString *) folderKey - (id) lookupFolder: (NSString *) folderKey
{ {
MAPIStoreFolder *childFolder; MAPIStoreFolder *childFolder = nil;
SOGoFolder *sogoFolder; SOGoFolder *sogoFolder;
WOContext *woContext;
childFolder = nil;
if ([[self folderKeys] containsObject: folderKey]) if ([[self folderKeys] containsObject: folderKey])
{ {
woContext = [[self userContext] woContext]; [[self userContext] activate];
/* We activate the user for the context using the root folder sogoFolder = [sogoObject lookupName: folderKey
context as there are times where the active user is not inContext: nil
matching with the one stored in the application context
and SOGo object is storing cached data with the wrong user */
[[self userContext] activateWithUser: [woContext activeUser]];
sogoFolder = [sogoObject lookupName: folderKey inContext: woContext
acquire: NO]; acquire: NO];
if (sogoFolder && ![sogoFolder isKindOfClass: NSExceptionK]) if (sogoFolder && ![sogoFolder isKindOfClass: NSExceptionK])
{ childFolder = [isa mapiStoreObjectWithSOGoObject: sogoFolder
[sogoFolder setContext: woContext]; inContainer: self];
childFolder = [isa mapiStoreObjectWithSOGoObject: sogoFolder
inContainer: self];
}
} }
else
childFolder = nil;
return childFolder; return childFolder;
} }