(fix) safeguard ourselves againts mailboxes with no quota
This commit is contained in:
parent
98e780dc6f
commit
d2f164dfb7
|
@ -287,17 +287,19 @@
|
||||||
|
|
||||||
- (WOResponse *) batchDeleteAction
|
- (WOResponse *) batchDeleteAction
|
||||||
{
|
{
|
||||||
SOGoMailFolder *co;
|
|
||||||
SOGoMailAccount *account;
|
|
||||||
SOGoUserSettings *us;
|
|
||||||
WORequest *request;
|
|
||||||
WOResponse *response;
|
|
||||||
id uids;
|
|
||||||
NSDictionary *data;
|
|
||||||
BOOL withTrash;
|
|
||||||
NSMutableDictionary *moduleSettings, *threadsCollapsed;
|
NSMutableDictionary *moduleSettings, *threadsCollapsed;
|
||||||
NSString *currentMailbox, *currentAccount, *keyForMsgUIDs;
|
NSString *currentMailbox, *currentAccount, *keyForMsgUIDs;
|
||||||
NSMutableArray *mailboxThreadsCollapsed;
|
NSMutableArray *mailboxThreadsCollapsed;
|
||||||
|
SOGoMailAccount *account;
|
||||||
|
SOGoUserSettings *us;
|
||||||
|
WOResponse *response;
|
||||||
|
SOGoMailFolder *co;
|
||||||
|
NSDictionary *data;
|
||||||
|
WORequest *request;
|
||||||
|
|
||||||
|
id uids, quota;
|
||||||
|
|
||||||
|
BOOL withTrash;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
response = nil;
|
response = nil;
|
||||||
|
@ -315,9 +317,16 @@
|
||||||
{
|
{
|
||||||
// When not using a trash folder, return the quota
|
// When not using a trash folder, return the quota
|
||||||
account = [co mailAccountFolder];
|
account = [co mailAccountFolder];
|
||||||
data = [NSDictionary dictionaryWithObjectsAndKeys: [account getInboxQuota], @"quotas", nil];
|
quota = [account getInboxQuota];
|
||||||
response = [self responseWithStatus: 200
|
|
||||||
andString: [data jsonRepresentation]];
|
if (quota)
|
||||||
|
{
|
||||||
|
data = [NSDictionary dictionaryWithObjectsAndKeys: quota, @"quotas", nil];
|
||||||
|
response = [self responseWithStatus: 200
|
||||||
|
andString: [data jsonRepresentation]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
response = [self responseWithStatus: 200];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -412,6 +421,8 @@
|
||||||
NSDictionary *data;
|
NSDictionary *data;
|
||||||
NSArray *uids;
|
NSArray *uids;
|
||||||
|
|
||||||
|
id quota;
|
||||||
|
|
||||||
co = [self clientObject];
|
co = [self clientObject];
|
||||||
data = [[[context request] contentAsString] objectFromJSONString];
|
data = [[[context request] contentAsString] objectFromJSONString];
|
||||||
uids = [data objectForKey: @"uids"];
|
uids = [data objectForKey: @"uids"];
|
||||||
|
@ -425,8 +436,15 @@
|
||||||
{
|
{
|
||||||
// We return the inbox quota
|
// We return the inbox quota
|
||||||
account = [co mailAccountFolder];
|
account = [co mailAccountFolder];
|
||||||
data = [NSDictionary dictionaryWithObject: [account getInboxQuota] forKey: @"quotas"];
|
quota = [account getInboxQuota];
|
||||||
response = [self responseWithStatus: 200 andJSONRepresentation: data];
|
|
||||||
|
if (quota)
|
||||||
|
{
|
||||||
|
data = [NSDictionary dictionaryWithObject: quota forKey: @"quotas"];
|
||||||
|
response = [self responseWithStatus: 200 andJSONRepresentation: data];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
response = [self responseWithStatus: 200];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue