Fix usage of SOGoSubscriptionFolderFormat default

pull/53/head
Francis Lachapelle 2014-08-25 12:15:05 -04:00
parent 28f26ec08e
commit e4a84d4920
3 changed files with 35 additions and 35 deletions

1
NEWS
View File

@ -11,6 +11,7 @@ Bug fixes
- fixed crasher when subscribing users to resources (#2892) - fixed crasher when subscribing users to resources (#2892)
- fixed encoding of new calendars and new subscriptions (JavaScript only) - fixed encoding of new calendars and new subscriptions (JavaScript only)
- fixed display of users with no possible subscription - fixed display of users with no possible subscription
- fixed usage of SOGoSubscriptionFolderFormat domain default when the folder's name hasn't been changed
2.2.7 (2014-07-30) 2.2.7 (2014-07-30)
------------------ ------------------

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2004-2005 SKYRIX Software AG Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2013 Inverse inc. Copyright (C) 2006-2014 Inverse inc.
This file is part of SOGo. This file is part of SOGo.
@ -53,7 +53,6 @@
NSString *ocsPath; NSString *ocsPath;
GCSFolder *ocsFolder; GCSFolder *ocsFolder;
NSMutableDictionary *childRecords; NSMutableDictionary *childRecords;
NSMutableDictionary *folderSubscriptionValues;
BOOL userCanAccessAllObjects; /* i.e. user obtains 'Access Object' on BOOL userCanAccessAllObjects; /* i.e. user obtains 'Access Object' on
subobjects */ subobjects */
} }
@ -102,7 +101,8 @@
withReference: (NSString *) reference; withReference: (NSString *) reference;
- (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
reallyDo: (BOOL) reallyDo; reallyDo: (BOOL) reallyDo
response: (WOResponse *) theResponse;
- (BOOL) userIsSubscriber: (NSString *) subscribingUser; - (BOOL) userIsSubscriber: (NSString *) subscribingUser;
- (void) initializeQuickTablesAclsInContext: (WOContext *) localContext; - (void) initializeQuickTablesAclsInContext: (WOContext *) localContext;

View File

@ -196,7 +196,6 @@ static NSArray *childRecordFields = nil;
ocsPath = nil; ocsPath = nil;
ocsFolder = nil; ocsFolder = nil;
childRecords = [NSMutableDictionary new]; childRecords = [NSMutableDictionary new];
folderSubscriptionValues = nil;
userCanAccessAllObjects = NO; userCanAccessAllObjects = NO;
} }
@ -208,7 +207,6 @@ static NSArray *childRecordFields = nil;
[ocsFolder release]; [ocsFolder release];
[ocsPath release]; [ocsPath release];
[childRecords release]; [childRecords release];
[folderSubscriptionValues release];
[super dealloc]; [super dealloc];
} }
@ -287,9 +285,6 @@ static NSArray *childRecordFields = nil;
- (void) _setDisplayNameFromRow: (NSDictionary *) row - (void) _setDisplayNameFromRow: (NSDictionary *) row
{ {
NSString *primaryDN; NSString *primaryDN;
NSDictionary *ownerIdentity;
NSString *subjectFormat;
SOGoDomainDefaults *dd;
primaryDN = [row objectForKey: @"c_foldername"]; primaryDN = [row objectForKey: @"c_foldername"];
@ -301,7 +296,7 @@ static NSArray *childRecordFields = nil;
displayName = [self labelForKey: primaryDN displayName = [self labelForKey: primaryDN
inContext: context]; inContext: context];
else else
displayName =primaryDN; displayName = primaryDN;
RETAIN(displayName); RETAIN(displayName);
} }
@ -348,7 +343,31 @@ static NSArray *childRecordFields = nil;
- (void) _fetchDisplayNameFromSubscriber - (void) _fetchDisplayNameFromSubscriber
{ {
NSDictionary *ownerIdentity, *folderSubscriptionValues;
NSString *displayNameFormat;
SOGoDomainDefaults *dd;
displayName = [self folderPropertyValueInCategory: @"FolderDisplayNames"]; displayName = [self folderPropertyValueInCategory: @"FolderDisplayNames"];
if (!displayName)
{
[self _fetchDisplayNameFromOwner];
// We MUST NOT use SOGoUser instances here (by calling -primaryIdentity)
// as it'll load user defaults and user settings which is _very costly_
// since it involves JSON parsing and database requests
ownerIdentity = [[SOGoUserManager sharedUserManager]
contactInfosForUserWithUIDorEmail: owner];
folderSubscriptionValues = [[NSDictionary alloc] initWithObjectsAndKeys: displayName, @"FolderName",
[ownerIdentity objectForKey: @"cn"], @"UserName",
[ownerIdentity objectForKey: @"c_email"], @"Email", nil];
dd = [[context activeUser] domainDefaults];
displayNameFormat = [dd subscriptionFolderFormat];
displayName = [folderSubscriptionValues keysWithFormat: displayNameFormat];
}
[displayName retain]; [displayName retain];
} }
@ -855,13 +874,10 @@ static NSArray *childRecordFields = nil;
reallyDo: (BOOL) reallyDo reallyDo: (BOOL) reallyDo
response: (WOResponse *) theResponse response: (WOResponse *) theResponse
{ {
NSDictionary *ownerIdentity, *folderSubscriptionValues;
NSMutableDictionary *moduleSettings, *folderShowAlarms; NSMutableDictionary *moduleSettings, *folderShowAlarms;
NSString *subjectFormat, *formattedName;
NSMutableArray *folderSubscription; NSMutableArray *folderSubscription;
NSString *subscriptionPointer; NSString *subscriptionPointer;
NSMutableArray *allUsers; NSMutableArray *allUsers;
SOGoDomainDefaults *dd;
SOGoUserSettings *us; SOGoUserSettings *us;
NSDictionary *dict; NSDictionary *dict;
SOGoUser *sogoUser; SOGoUser *sogoUser;
@ -869,7 +885,7 @@ static NSArray *childRecordFields = nil;
int i; int i;
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier]; dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier];
if ([[dict objectForKey: @"isGroup"] boolValue]) if ([[dict objectForKey: @"isGroup"] boolValue])
{ {
SOGoGroup *aGroup; SOGoGroup *aGroup;
@ -891,28 +907,12 @@ static NSArray *childRecordFields = nil;
else else
allUsers = [NSArray array]; allUsers = [NSArray array];
} }
rc = NO; rc = NO;
// We MUST NOT use SOGoUser instances here (by calling -primaryIdentity)
// as it'll load user defaults and user settings which is _very costly_
// since it involves JSON parsing and database requests
ownerIdentity = [[SOGoUserManager sharedUserManager]
contactInfosForUserWithUIDorEmail: owner];
folderSubscriptionValues = [[NSDictionary alloc] initWithObjectsAndKeys: [self displayName], @"FolderName",
[ownerIdentity objectForKey: @"cn"], @"UserName",
[ownerIdentity objectForKey: @"c_email"], @"Email", nil];
dd = [[context activeUser] domainDefaults];
subjectFormat = [dd subscriptionFolderFormat];
formattedName = [folderSubscriptionValues keysWithFormat: subjectFormat];
// This is consumed by SOGo Integrator during folder subscription since v24.0.6 // This is consumed by SOGo Integrator during folder subscription since v24.0.6
if (theResponse) if (theResponse)
[theResponse appendContentString: formattedName]; [theResponse appendContentString: [self displayName]];
for (i = 0; i < [allUsers count]; i++) for (i = 0; i < [allUsers count]; i++)
{ {
@ -926,8 +926,7 @@ static NSArray *childRecordFields = nil;
[us setObject: moduleSettings forKey: [container nameInContainer]]; [us setObject: moduleSettings forKey: [container nameInContainer]];
} }
folderSubscription folderSubscription = [moduleSettings objectForKey: @"SubscribedFolders"];
= [moduleSettings objectForKey: @"SubscribedFolders"];
subscriptionPointer = [self folderReference]; subscriptionPointer = [self folderReference];
folderShowAlarms = [moduleSettings objectForKey: @"FolderShowAlarms"]; folderShowAlarms = [moduleSettings objectForKey: @"FolderShowAlarms"];
@ -950,7 +949,7 @@ static NSArray *childRecordFields = nil;
forKey: @"FolderShowAlarms"]; forKey: @"FolderShowAlarms"];
} }
[self setFolderPropertyValue: formattedName [self setFolderPropertyValue: [self displayName]
inCategory: @"FolderDisplayNames" inCategory: @"FolderDisplayNames"
settings: us]; settings: us];