(fix) cache sogo_folder_info records and avoid phantom subscriptions (fixes #4010)

This commit is contained in:
Ludovic Marcotte
2017-01-31 15:59:58 -05:00
parent d159b191a6
commit 15b277fa8e
4 changed files with 28 additions and 11 deletions
+18 -1
View File
@@ -424,7 +424,23 @@ static NSArray *childRecordFields = nil;
- (GCSFolder *) ocsFolderForPath: (NSString *) _path
{
return [[self folderManager] folderAtPath: _path];
NSDictionary *record;
SOGoCache *cache;
cache = [SOGoCache sharedCache];
record = [[cache valueForKey: _path] objectFromJSONString];
if (!record)
{
record = [[self folderManager] recordAtPath: _path];
if (!record)
return nil;
[cache setValue: [record jsonRepresentation] forKey: _path];
}
return [[self folderManager] folderForRecord: record];
}
- (BOOL) folderIsMandatory
@@ -578,6 +594,7 @@ static NSArray *childRecordFields = nil;
[self removeFolderSettings: moduleSettings
withReference: [self folderReference]];
[us synchronize];
[[SOGoCache sharedCache] removeValueForKey: ocsPath];
if ([[context request] handledByDefaultHandler])
[self sendFolderAdvisoryTemplate: @"Removal"];