Compare commits

..
14 Commits
Author SHA1 Message Date
Hivert Quentin 68f4fc1343 fix(mail): improve algo to fetch imap folders for mail view 2024-09-11 09:05:53 +02:00
smizrahi 2a1744998c fix(calendar): Fix regression on repeat task 2024-09-09 14:10:33 +02:00
Hivert Quentin 01607b151d chore(js/css): update generated files 2024-09-05 01:00:37 -04:00
smizrahi 0cbd082c1d fix(mail): Fix highlighsearch html rendering on subject 2024-09-04 18:03:36 +02:00
smizrahi 41a0f8d9af fix(mail): Fix HTML mail rendering issue 2024-09-04 15:10:05 +02:00
Hivert Quentin 2dd10970a4 fix(ckeditor5): prevent ckeditor5 to preview media 2024-09-03 13:37:19 +02:00
smizrahi 2f75a7fb1b fix(calendar): Fix all day recurring event displayed on 2 days when a DST change occurs at the endDate 2024-08-28 10:27:00 +02:00
Hivert Quentin c1e4dc5a0e chore(js/css): update generated files 2024-08-28 01:00:36 -04:00
smizrahi fa2caf9026 fix(mail): Add an option in Preferences to display full email instead of name alone in mailboxes. Fix issue caused by advanced search. 2024-08-27 18:40:36 +02:00
Hivert Quentin f42f94da84 chore(js/css): update generated files 2024-08-21 01:00:55 -04:00
smizrahi 1f6bbc1044 fix(mail): Fix issue where unread counter is invalid when whanging folder. Fixes #6001. 2024-08-20 14:52:03 +02:00
Hivert Quentin a24d59dfaf chore(js/css): update generated files 2024-08-20 01:00:53 -04:00
smizrahi 91a249009b fix(mail): Fix issue where unread counter is invalid when whanging folder. Fixes #6001. 2024-08-19 18:16:33 +02:00
Hivert Quentin 16f371dba7 chore(js/css): update generated files 2024-08-17 01:00:52 -04:00
15 changed files with 189 additions and 187 deletions

No files matched your search

+146 -144
View File
@@ -454,19 +454,22 @@ static NSString *inboxFolderName = @"INBOX";
//
- (NSString *) _folderType: (NSString *) folderName
flags: (NSMutableArray *) flags
folderTypes: (NSDictionary *) folderTypes
{
static NSDictionary *metadata = nil;
NSString *folderType, *key, *rights;
static NSDictionary *folderTypeDict = nil;
NSString *folderType, *key, *rights, *flag;
NSEnumerator *flagEnum;
SOGoUserDefaults *ud;
if (!metadata)
{
ud = [[context activeUser] userDefaults];
metadata = [[[self imap4Connection] allFoldersMetadataForURL: [self imap4URL]
onlySubscribedFolders: [ud mailShowSubscribedFoldersOnly]]
objectForKey: @"list"];
[metadata retain];
}
{
ud = [[context activeUser] userDefaults];
metadata = [[[self imap4Connection] allFoldersMetadataForURL: [self imap4URL]
onlySubscribedFolders: [ud mailShowSubscribedFoldersOnly]]
objectForKey: @"list"];
[metadata retain];
}
key = [NSString stringWithFormat: @"/%@", folderName];
[flags addObjectsFromArray: [metadata objectForKey: key]];
@@ -474,44 +477,32 @@ static NSString *inboxFolderName = @"INBOX";
// RFC6154 (https://tools.ietf.org/html/rfc6154) describes special uses for IMAP mailboxes.
// We do honor them, as long as your SOGo{Drafts,Trash,Sent,Junk}FolderName are properly configured
// See http://wiki.dovecot.org/MailboxSettings for a Dovecot example.
if ([folderName isEqualToString: inboxFolderName])
folderType = @"inbox";
else if ([flags containsObject: [self draftsFolderNameInContext: context]] ||
[folderName isEqualToString: [self draftsFolderNameInContext: context]])
folderType = @"draft";
else if ([flags containsObject: [self sentFolderNameInContext: context]] ||
[folderName isEqualToString: [self sentFolderNameInContext: context]])
folderType = @"sent";
else if ([flags containsObject: [self trashFolderNameInContext: context]] ||
[folderName isEqualToString: [self trashFolderNameInContext: context]])
folderType = @"trash";
else if ([flags containsObject: [self junkFolderNameInContext: context]] ||
[folderName isEqualToString: [self junkFolderNameInContext: context]])
folderType = @"junk";
else if ([flags containsObject: [self templatesFolderNameInContext: context]] ||
[folderName isEqualToString: [self templatesFolderNameInContext: context]])
folderType = @"templates";
else if ([folderName isEqualToString: otherUsersFolderName])
folderType = @"otherUsers";
else if ([folderName isEqualToString: sharedFoldersName])
folderType = @"shared";
else
if((folderType = [folderTypes objectForKey: folderName]))
return folderType;
flagEnum = [flags objectEnumerator];
while((flag = [flagEnum nextObject]))
{
if([flag isEqualToString: inboxFolderName] || [flag isEqualToString: otherUsersFolderName] || [flag isEqualToString: sharedFoldersName])
continue;
if((folderType = [folderTypes objectForKey: flag]))
return folderType;
}
folderType = @"folder";
if (([sharedFoldersName length] && [folderName hasPrefix: sharedFoldersName]) ||
([otherUsersFolderName length] && [folderName hasPrefix: otherUsersFolderName]))
{
rights = [[self imap4Connection] myRightsForMailboxAtURL: [NSURL URLWithString: folderName]];
if (![rights isKindOfClass: [NSException class]] &&
([rights rangeOfString: @"r"].location == NSNotFound))
{
folderType = @"folder";
if (([sharedFoldersName length] && [folderName hasPrefix: sharedFoldersName]) ||
([otherUsersFolderName length] && [folderName hasPrefix: otherUsersFolderName]))
{
rights = [[self imap4Connection] myRightsForMailboxAtURL: [NSURL URLWithString: folderName]];
if (![rights isKindOfClass: [NSException class]] &&
([rights rangeOfString: @"r"].location == NSNotFound))
{
[flags addObjectUniquely: @"noselect"];
if ([rights rangeOfString: @"i"].location != NSNotFound)
// No read but insert = dropbox
folderType = @"dropbox";
}
}
[flags addObjectUniquely: @"noselect"];
if ([rights rangeOfString: @"i"].location != NSNotFound)
// No read but insert = dropbox
folderType = @"dropbox";
}
}
return folderType;
}
@@ -521,6 +512,7 @@ static NSString *inboxFolderName = @"INBOX";
//
- (NSMutableDictionary *) _insertFolder: (NSString *) folderPath
foldersList: (NSMutableArray *) theFolders
folderTypes: (NSDictionary *) folderTypes
{
NSArray *pathComponents;
NSMutableArray *folders, *flags;
@@ -541,103 +533,99 @@ static NSString *inboxFolderName = @"INBOX";
// The variable folderPath is something like '/INBOX/Junk' so pathComponents becomes ('/', 'INBOX', 'Junk').
// That's why we always ignore the first element
for (i = 1; i < count; i++)
{
last = ((count - i) == 1);
folder = nil;
if ([currentPath length])
currentPath = [NSString stringWithFormat: @"%@/%@", currentPath, [pathComponents objectAtIndex: i]];
else
currentPath = [pathComponents objectAtIndex: i];
// Search for the current path in the children of the parent folder.
// For the first iteration, take the parent folder passed as argument.
if (parentFolder)
folders = [parentFolder objectForKey: @"children"];
else
folders = theFolders;
for (j = 0; j < [folders count]; j++)
{
last = ((count - i) == 1);
folder = nil;
if ([currentPath length])
currentPath = [NSString stringWithFormat: @"%@/%@", currentPath, [pathComponents objectAtIndex: i]];
else
currentPath = [pathComponents objectAtIndex: i];
// Search for the current path in the children of the parent folder.
// For the first iteration, take the parent folder passed as argument.
if (parentFolder)
folders = [parentFolder objectForKey: @"children"];
else
folders = theFolders;
for (j = 0; j < [folders count]; j++)
{
currentFolder = [folders objectAtIndex: j];
if ([currentPath isEqualToString: [currentFolder objectForKey: @"path"]])
{
folder = currentFolder;
// Make sure all branches are ready to receive children
if (!last && ![folder objectForKey: @"children"])
[folder setObject: [NSMutableArray array] forKey: @"children"];
break;
}
}
// Check if the current folder is the "Other users" folder (shared mailboxes)
currentFolderName = [[pathComponents objectAtIndex: i] stringByDecodingImap4FolderName];
if (otherUsersFolderName
&& [currentFolderName caseInsensitiveCompare: otherUsersFolderName] == NSOrderedSame)
isOtherUsersFolder = YES;
else
isOtherUsersFolder = NO;
if (folder == nil)
{
// Folder was not found; create it and add it to the folders list
if (parentIsOtherUsersFolder)
{
// Parent folder is the "Other users" folder; translate the user's mailbox name
// to the full name of the person
userManager = [SOGoUserManager sharedUserManager];
if ((fullName = [userManager getCNForUID: currentFolderName]) && [fullName length])
currentFolderName = fullName;
else if ((fullName = [userManager getEmailForUID: currentFolderName]) && [fullName length])
currentFolderName = fullName;
}
else if (isOtherUsersFolder)
currentFolderName = [self labelForKey: @"OtherUsersFolderName"];
else if (sharedFoldersName
&& [currentFolderName caseInsensitiveCompare: sharedFoldersName] == NSOrderedSame)
currentFolderName = [self labelForKey: @"SharedFoldersName"];
flags = [NSMutableArray array];
if (last)
{
folderType = [self _folderType: currentPath
flags: flags];
}
else
{
folderType = @"additional";
[flags addObject: @"noselect"];
}
if ([subscribedFolders objectForKey: folderPath])
isSubscribed = YES;
else
isSubscribed = NO;
folder = [NSMutableDictionary dictionaryWithObjectsAndKeys:
currentPath, @"path",
folderType, @"type",
currentFolderName, @"name",
[NSMutableArray array], @"children",
flags, @"flags",
[NSNumber numberWithBool: isSubscribed], @"subscribed",
nil];
if (sieveFolderUTF8Encoding)
sievePath = [currentPath stringByDecodingImap4FolderName];
else
sievePath = currentPath;
[folder setObject: sievePath forKey: @"sievePath"];
// Either add this new folder to its parent or the list of root folders
[folders addObject: folder];
}
parentFolder = folder;
parentIsOtherUsersFolder = isOtherUsersFolder;
currentFolder = [folders objectAtIndex: j];
if ([currentPath isEqualToString: [currentFolder objectForKey: @"path"]])
{
folder = currentFolder;
// Make sure all branches are ready to receive children
if (!last && ![folder objectForKey: @"children"])
[folder setObject: [NSMutableArray array] forKey: @"children"];
break;
}
}
// Check if the current folder is the "Other users" folder (shared mailboxes)
currentFolderName = [[pathComponents objectAtIndex: i] stringByDecodingImap4FolderName];
if (otherUsersFolderName && [currentFolderName caseInsensitiveCompare: otherUsersFolderName] == NSOrderedSame)
isOtherUsersFolder = YES;
else
isOtherUsersFolder = NO;
if (folder == nil)
{
// Folder was not found; create it and add it to the folders list
if (parentIsOtherUsersFolder)
{
// Parent folder is the "Other users" folder; translate the user's mailbox name
// to the full name of the person
userManager = [SOGoUserManager sharedUserManager];
if ((fullName = [userManager getCNForUID: currentFolderName]) && [fullName length])
currentFolderName = fullName;
else if ((fullName = [userManager getEmailForUID: currentFolderName]) && [fullName length])
currentFolderName = fullName;
}
else if (isOtherUsersFolder)
currentFolderName = [self labelForKey: @"OtherUsersFolderName"];
else if (sharedFoldersName && [currentFolderName caseInsensitiveCompare: sharedFoldersName] == NSOrderedSame)
currentFolderName = [self labelForKey: @"SharedFoldersName"];
flags = [NSMutableArray array];
if (last)
{
folderType = [self _folderType: currentPath flags: flags folderTypes: folderTypes];
}
else
{
folderType = @"additional";
[flags addObject: @"noselect"];
}
if ([subscribedFolders objectForKey: folderPath])
isSubscribed = YES;
else
isSubscribed = NO;
folder = [NSMutableDictionary dictionaryWithObjectsAndKeys:
currentPath, @"path",
folderType, @"type",
currentFolderName, @"name",
[NSMutableArray array], @"children",
flags, @"flags",
[NSNumber numberWithBool: isSubscribed], @"subscribed",
nil];
if (sieveFolderUTF8Encoding)
sievePath = [currentPath stringByDecodingImap4FolderName];
else
sievePath = currentPath;
[folder setObject: sievePath forKey: @"sievePath"];
// Either add this new folder to its parent or the list of root folders
[folders addObject: folder];
}
parentFolder = folder;
parentIsOtherUsersFolder = isOtherUsersFolder;
}
return parentFolder;
}
@@ -651,11 +639,25 @@ static NSString *inboxFolderName = @"INBOX";
NSEnumerator *rawFolders;
NSAutoreleasePool *pool;
NSArray *allFolderPaths;
NSMutableDictionary *folderTypes;
allFolderPaths = [self allFolderPaths: theListingMode];
rawFolders = [allFolderPaths objectEnumerator];
folders = [NSMutableArray array];
folderTypes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"inbox", inboxFolderName,
@"draft", [self draftsFolderNameInContext: context],
@"sent", [self sentFolderNameInContext: context],
@"trash", [self trashFolderNameInContext: context],
@"junk", [self junkFolderNameInContext: context],
@"templates", [self templatesFolderNameInContext: context],
nil];
if(otherUsersFolderName && [otherUsersFolderName length] > 0)
[folderTypes setObject: @"otherUsers" forKey: otherUsersFolderName];
if(sharedFoldersName && [sharedFoldersName length] > 0)
[folderTypes setObject: @"shared" forKey: sharedFoldersName];
while ((currentFolder = [rawFolders nextObject]))
{
// Using a local pool to avoid using too many file descriptors. This could
@@ -666,7 +668,8 @@ static NSString *inboxFolderName = @"INBOX";
// Insert folder into folders tree
[self _insertFolder: currentFolder
foldersList: folders];
foldersList: folders
folderTypes: folderTypes];
[pool release];
}
@@ -1119,11 +1122,10 @@ static NSString *inboxFolderName = @"INBOX";
folderName = [[account objectForKey: @"specialMailboxes"]
objectForKey: purpose];
if (!folderName && accountIdx > 0)
{
account = [accounts objectAtIndex: 0];
folderName = [[account objectForKey: @"specialMailboxes"]
objectForKey: purpose];
}
{
account = [accounts objectAtIndex: 0];
folderName = [[account objectForKey: @"specialMailboxes"] objectForKey: purpose];
}
return folderName;
}
+2
View File
@@ -31,6 +31,8 @@
NSString *fieldName;
}
- (unsigned long long)getCDefaultsSize;
@end
#endif /* SOGOSQLUSERPROFILE_H */
-2
View File
@@ -64,8 +64,6 @@ typedef enum _SOGoUserProfileType {
- (void) setUID: (NSString *) newUID;
- (NSString *) uid;
- (unsigned long long)getCDefaultsSize;
/* value access */
- (void) setValues: (NSDictionary *) theValues;
- (NSDictionary *) values;
-10
View File
@@ -101,7 +101,6 @@
return uid;
}
/* subclass methods */
- (BOOL) storeJSONProfileInDB: (NSString *) jsonRepresentation
@@ -118,15 +117,6 @@
return nil;
}
- (unsigned long long)getCDefaultsSize
{
unsigned long long ret = 0;
[self subclassResponsibility: _cmd];
return ret;
}
/* operation */
- (NSString *) _convertPListToJSON: (NSString *) plistValue
+7 -4
View File
@@ -278,6 +278,9 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
unichar *sanitizedChars, *start, *currentChar;
BOOL inComment;
if (rawContent)
return;
/**
* Sanitize style
* - remove control characters
@@ -341,10 +344,11 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
}
}
}
if (!inComment && currentChar > start)
if (!inComment && currentChar > start) {
if (*currentChar == '}' && *currentChar++ == '\000') currentChar++; // Add offset
[sanitizedStyle appendString: [NSString stringWithCharacters: start
length: (currentChar - start)]];
}
/**
* Parse sanitized style
* - remove at-rule definitions
@@ -384,8 +388,7 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
(*(currentChar-7) == 'p' || *(currentChar-7) == 'P') &&
(*(currentChar-8) == 'm' || *(currentChar-8) == 'M') &&
(*(currentChar-9) == 'i' || *(currentChar-9) == 'I') &&
*(currentChar-10) == '!')
&& !rawContent)
*(currentChar-10) == '!'))
{
length = (currentChar - start);
[declaration appendFormat: @"%@ !important;",
+1 -1
View File
@@ -351,7 +351,7 @@ static NSArray *tasksFields = nil;
if (daylightOffset)
{
// If it is the end date and allday, we need to remove the offset
if ([fields[count * 2] isEqualToString: @"endDate"] && [[theRecord objectForKey: @"c_isallday"] boolValue])
if ([fields[count * 2] isEqualToString: @"endDate"] && [[theRecord objectForKey: @"c_isallday"] boolValue] && daylightOffset > 0)
aDate = [aDate dateByAddingYears: 0 months: 0 days: 0 hours: 0
minutes: 0 seconds: -1 * daylightOffset];
else
@@ -157,7 +157,8 @@
sg-email="::viewer.message.from[0].email"
size="40">person</sg-avatar-image>
<div>
<span ng-bind-html="::viewer.message.from[0].name"><!-- from --></span>
<span ng-if="viewer.message.from[0].nameHighlighted" ng-bind-html="::viewer.message.from[0].nameHighlighted"><!-- from --></span>
<span ng-if="!viewer.message.from[0].nameHighlighted" ng-bind-html="::viewer.message.from[0].name"><!-- from --></span>
<a href="#" class="md-caption"
ng-bind="::viewer.message.from[0].email"
ng-click="viewer.selectRecipient(viewer.message.from[0], $event)"><!-- from --></a>
@@ -205,19 +205,7 @@
<div class="sg-form-section"
ng-show="editor.component.start">
<div layout="row" layout-align="start center">
<md-input-container class="md-block md-flex">
<label><var:string label:value="Repeat"/></label>
<md-select ng-model="editor.component.repeat.frequency" ng-disabled="editor.component.occurrenceId">
<md-option ng-value="frequency[0]" ng-repeat="frequency in ::editor.frequencies()" ng-bind-html="frequency[1]"><!-- frequency --></md-option>
</md-select>
</md-input-container>
<md-button type="button" class="sg-icon-button"
label:aria-label="repeat_CUSTOM"
ng-disabled="editor.component.occurrenceId"
ng-show="editor.component.repeat.frequency != 'never'"
ng-click="editor.toggleRecurrenceEditor()">
<md-icon ng-class="{'md-rotate-45': editor.showRecurrenceEditor}">add</md-icon>
</md-button>
<var:component className="UIxRecurrenceListEditor" />
</div>
<div ng-show="editor.showRecurrenceEditor" flex-offset="5">
<var:component className="UIxRecurrenceEditor" />
@@ -260,6 +260,9 @@
config.htmlEmbed = {
showPreviews: true
};
config.mediaEmbed = {
providers: []
};
config.image = {
resizeUnit: "px",
insert: {
+1 -1
View File
@@ -1,2 +1,2 @@
!function(){"use strict";function c(e){var t=this;"function"!=typeof e.then&&(angular.extend(this,e),_.forEach(this.identities,function(e){var t;e.fullName&&e.email?e.full=e.fullName+" <"+e.email+">":e.email?e.full="<"+e.email+">":e.full="",e.signature&&(t=angular.element("<div>"+e.signature+"</div>"),e.textSignature=_.map(t.contents(),"textContent").join(" ").trim())}),this.$mailboxes)&&c.$Mailbox.$unwrapCollection(this,c.$q.when({mailboxes:this.$mailboxes})).then(function(e){t.$mailboxes=e})}c.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Mailbox","Message",function(e,t,s,n,i,a,o,r){return angular.extend(c,{$q:e,$timeout:t,$log:s,$$resource:new i(n.activeUser("folderURL")+"Mail",n.activeUser()),$Preferences:a,$Mailbox:o,$Message:r}),c}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").factory("Account",c.$factory),c.$findAll=function(e){return e?c.$unwrapCollection(e):c.$accounts?c.$q.when(c.$accounts):c.$$resource.fetch("","mailAccounts").then(function(e){return c.$unwrapCollection(e)})},c.$unwrapCollection=function(e){var s=[];return angular.forEach(e,function(e,t){e.id=t,s[t]=new c(e)}),c.$accounts=s},c.refreshUnseenCount=function(e){var t,s=1===c.$Preferences.defaults.SOGoMailFetchAllUnseenCountFolders,n=c.$Preferences.defaults.SOGoRefreshViewCheck;if(s)t=[];else{if(!e)throw Error("SOGoMailFetchAllUnseenCountFolders is disabled and no folders list provided");t=e}_.forEach(c.$accounts,function(e){s?_.forEach(e.$$flattenMailboxes,function(e){t.push(e.id)}):(_.includes(t,e.id+"/folderINBOX")||t.push(e.id+"/folderINBOX"),_.forEach(e.$$flattenMailboxes,function(e){angular.isDefined(e.unseenCount)&&!_.includes(t,e.id)&&t.push(e.id)}))}),c.$$resource.post("","unseenCount",{mailboxes:t}).then(function(t){_.forEach(c.$accounts,function(e){_.forEach(e.$$flattenMailboxes,function(e){angular.isDefined(t[e.id])&&(e.unseenCount=t[e.id])})})}),n&&"manually"!=n&&(c.$refreshUnseenCount&&c.$timeout.cancel(c.$refreshUnseenCount),c.$refreshUnseenCount=c.$timeout(angular.bind(this,c.refreshUnseenCount,e),1e3*n.timeInterval()))},c.prototype.getLength=function(){return this.$expanded?this.$flattenMailboxes().length:0},c.prototype.getItemAtIndex=function(e){var t=this.$flattenMailboxes();return 0<=e&&e<t.length?t[e]:null},c.prototype.$getMailboxes=function(e){var a=this,t=e&&e.reload;return this.$mailboxes&&!t?c.$q.when(this.$mailboxes):(!t&&this.$futureMailboxesData||(this.$futureMailboxesData=c.$Mailbox.$find(this,e).then(function(e){function s(e){_.forEach(e,function(e){var t=_.find(n,["id",e.id]);t&&(e.unseenCount=t.unseenCount),e.children&&0<e.children.length&&s(e.children)})}var n=a.$flattenMailboxes({all:!0});a.$mailboxes=e,a.$expanded=!1;s(a.$mailboxes);function t(e){_.forEach(e,function(e){e.$expanded=0<=i.indexOf("/"+e.id),e.children&&0<e.children.length&&t(e.children)})}var i;if(c.$Preferences.settings.Mail.ExpandedFolders){if(angular.isString(c.$Preferences.settings.Mail.ExpandedFolders))try{i=angular.fromJson(c.$Preferences.settings.Mail.ExpandedFolders)}catch(e){c.$log.warn("Can't parse list of expanded folders. String was: "+c.$Preferences.settings.Mail.ExpandedFolders),i=[]}else i=c.$Preferences.settings.Mail.ExpandedFolders;a.$expanded=0<=i.indexOf("/"+a.id),0<i.length&&t(a.$mailboxes)}return c.$accounts&&(a.$expanded|=1==c.$accounts.length),a.$flattenMailboxes({reload:!0}),a.$mailboxes})),this.$futureMailboxesData)},c.prototype.$flattenMailboxes=function(t){function s(e){_.forEach(e,function(e){n.push(e),(t&&t.all||e.$expanded)&&e.children&&0<e.children.length&&s(e.children)})}var n=[],i=[];return!this.$$flattenMailboxes||t&&(t.reload||t.all)?(s(this.$mailboxes),t&&t.all||(this.$$flattenMailboxes=n,t&&t.saveState&&(_.forEach(c.$accounts,function(e){e.$expanded&&i.push("/"+e.id),_.reduce(e.$$flattenMailboxes,function(e,t){return t.$expanded&&e.push("/"+t.id),e},i)}),c.$$resource.post(null,"saveFoldersState",i)))):n=this.$$flattenMailboxes,n},c.prototype.$getMailboxByType=function(s){function n(e){var t=_.find(e,function(e){return e.type==s});return t||angular.forEach(e,function(e){!t&&e.children&&0<e.children.length&&(t=n(e.children))}),t}return n(this.$mailboxes)},c.prototype.$getMailboxByPath=function(s){function n(e){var t=_.find(e,function(e){return e.path==s});return t||angular.forEach(e,function(e){!t&&e.children&&0<e.children.length&&(t=n(e.children))}),t}var e;if(null==(e=n(this.$mailboxes)))throw Error("No mailbox found matching path "+s);return e},c.prototype.$newMailbox=function(e,t){var s=this;return c.$$resource.post(e.toString(),"createFolder",{name:t}).then(function(){s.$getMailboxes({reload:!0})})},c.prototype.getTextSignature=function(e){var t;return e.signature?(t=angular.element("<div>"+e.signature+"</div>"),e.textSignature=_.map(t.contents(),"textContent").join(" ").trim()):e.textSignature="",e.textSignature},c.prototype.$hasCertificate=function(){return this.security&&this.security.hasCLine truncated
!function(){"use strict";function c(e){var t=this;"function"!=typeof e.then&&(angular.extend(this,e),_.forEach(this.identities,function(e){var t;e.fullName&&e.email?e.full=e.fullName+" <"+e.email+">":e.email?e.full="<"+e.email+">":e.full="",e.signature&&(t=angular.element("<div>"+e.signature+"</div>"),e.textSignature=_.map(t.contents(),"textContent").join(" ").trim())}),this.$mailboxes)&&c.$Mailbox.$unwrapCollection(this,c.$q.when({mailboxes:this.$mailboxes})).then(function(e){t.$mailboxes=e})}c.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Mailbox","Message",function(e,t,s,n,i,a,o,r){return angular.extend(c,{$q:e,$timeout:t,$log:s,$$resource:new i(n.activeUser("folderURL")+"Mail",n.activeUser()),$Preferences:a,$Mailbox:o,$Message:r}),c}];try{angular.module("SOGo.MailerUI")}catch(e){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").factory("Account",c.$factory),c.$findAll=function(e){return e?c.$unwrapCollection(e):c.$accounts?c.$q.when(c.$accounts):c.$$resource.fetch("","mailAccounts").then(function(e){return c.$unwrapCollection(e)})},c.$unwrapCollection=function(e){var s=[];return angular.forEach(e,function(e,t){e.id=t,s[t]=new c(e)}),c.$accounts=s},c.refreshUnseenCount=function(e){var t,s=1===c.$Preferences.defaults.SOGoMailFetchAllUnseenCountFolders,n=c.$Preferences.defaults.SOGoRefreshViewCheck;if(s)t=[];else{if(!e)throw Error("SOGoMailFetchAllUnseenCountFolders is disabled and no folders list provided");t=e}_.forEach(c.$accounts,function(e){s?_.forEach(e.$$flattenMailboxes,function(e){t.push(e.id)}):(_.includes(t,e.id+"/folderINBOX")||t.push(e.id+"/folderINBOX"),_.forEach(e.$$flattenMailboxes,function(e){angular.isDefined(e.unseenCount)&&!_.includes(t,e.id)&&t.push(e.id)}))}),c.$$resource.post("","unseenCount",{mailboxes:t}).then(function(t){_.forEach(c.$accounts,function(e){_.forEach(e.$$flattenMailboxes,function(e){angular.isDefined(t[e.id])&&(e.unseenCount=t[e.id])})})}),n&&"manually"!=n&&(c.$refreshUnseenCount&&c.$timeout.cancel(c.$refreshUnseenCount),c.$refreshUnseenCount=c.$timeout(angular.bind(this,c.refreshUnseenCount,e),1e3*n.timeInterval()))},c.prototype.getLength=function(){return this.$expanded?this.$flattenMailboxes().length:0},c.prototype.getItemAtIndex=function(e){var t=this.$flattenMailboxes();return 0<=e&&e<t.length?t[e]:null},c.prototype.$getMailboxes=function(e){var a=this,t=e&&e.reload;return this.$mailboxes&&!t?c.$q.when(this.$mailboxes):(!t&&this.$futureMailboxesData||(this.$futureMailboxesData=c.$Mailbox.$find(this,e).then(function(e){function s(e){_.forEach(e,function(e){var t=_.find(n,["id",e.id]);t&&(e.unseenCount=t.unseenCount),e.children&&0<e.children.length&&s(e.children)})}var n=a.$flattenMailboxes({all:!0});a.$mailboxes=e,a.$expanded=!1;s(a.$mailboxes);function t(e){_.forEach(e,function(e){e.$expanded=0<=i.indexOf("/"+e.id),e.children&&0<e.children.length&&t(e.children)})}var i;if(c.$Preferences.settings.Mail.ExpandedFolders){if(angular.isString(c.$Preferences.settings.Mail.ExpandedFolders))try{i=angular.fromJson(c.$Preferences.settings.Mail.ExpandedFolders)}catch(e){c.$log.warn("Can't parse list of expanded folders. String was: "+c.$Preferences.settings.Mail.ExpandedFolders),i=[]}else i=c.$Preferences.settings.Mail.ExpandedFolders;a.$expanded=0<=i.indexOf("/"+a.id),0<i.length&&t(a.$mailboxes)}return c.$accounts&&(a.$expanded|=1==c.$accounts.length),a.$flattenMailboxes({reload:!0}),a.$mailboxes})),this.$futureMailboxesData)},c.prototype.$flattenMailboxes=function(t){function s(e){_.forEach(e,function(e){n.push(e),(t&&t.all||e.$expanded)&&e.children&&0<e.children.length&&s(e.children)})}var n=[],i=[];return!this.$$flattenMailboxes||t&&(t.reload||t.all)?(s(this.$mailboxes),t&&t.all||(this.$$flattenMailboxes=n,t&&t.saveState&&(_.forEach(c.$accounts,function(e){e.$expanded&&i.push("/"+e.id),_.reduce(e.$$flattenMailboxes,function(e,t){return t.$expanded&&e.push("/"+t.id),e},i)}),c.$$resource.post(null,"saveFoldersState",i)))):n=this.$$flattenMailboxes,n},c.prototype.$getMailboxByType=function(s){function n(e){var t=_.find(e,function(e){return e.type==s});return t||angular.forEach(e,function(e){!t&&e.children&&0<e.children.length&&(t=n(e.children))}),t}return n(this.$mailboxes)},c.prototype.$getMailboxByPath=function(s){function n(e){var t=_.find(e,function(e){return e.path==s});return t||angular.forEach(e,function(e){!t&&e.children&&0<e.children.length&&(t=n(e.children))}),t}var e;if(null==(e=n(this.$mailboxes)))throw Error("No mailbox found matching path "+s);return e},c.prototype.$newMailbox=function(e,t){var s=this;return c.$$resource.post(e.toString(),"createFolder",{name:t}).then(function(){s.$getMailboxes({reload:!0})})},c.prototype.getTextSignature=function(e){var t;return e.signature?(t=angular.element("<div>"+e.signature+"</div>"),e.textSignature=_.map(t.contents(),"textContent").join(" ").trim()):e.textSignature="",e.textSignature},c.prototype.$hasCertificate=function(){return this.security&&this.security.hasCLine truncated
//# sourceMappingURL=Mailer.services.js.map
@@ -1 +1 @@
{"version":3,"file":"Mailer.services.js","sources":["Mailer/Account.service.js","Mailer/Mailbox.service.js","Mailer/Message.service.js","Mailer/sgImageGallery.service.js","Mailer/VirtualMailbox.service.js","Mailer/MailboxController.js","Mailer/MailboxesController.js","Mailer/MessageController.js","Mailer/MessageEditorController.js","Mailer/sgAccountSection.directive.js","Mailer/sgIMIP.directive.js","Mailer/sgMailboxListItem.directive.js","Mailer/sgMessageListItem.directive.js","Mailer/sgMessageListItemMain.directive.js","Mailer/sgZoomableImage.directive.js"],"names":["Account","futureAccountData","_this","this","then","angular","extend","_","forEach","identities","identity","element","fullName","email","full","signature","textSignature","map","contents","join","trim","$mailboxes","$Mailbox","$unwrapCollection","$q","when","mailboxes","collection","$factory","$timeout","$log","Settings","Resource","Preferences","Mailbox","Message","$$resource","activeUser","$Preferences","$Message","module","e","factory","$findAll","data","$accounts","fetch","o","i","id","refreshUnseenCount","folders","unseenCountFolders","fetchAllUnseenCountFolders","defaults","SOGoMailFetchAllUnseenCountFolders","refreshViewCheck","SOGoRefreshViewCheck","Error","account","$$flattenMailboxes","mailbox","push","includes","isDefined","unseenCount","post","$refreshUnseenCount","cancel","bind","timeInterval","prototype","getLength","$expanded","$flattenMailboxes","length","getItemAtIndex","index","expandedMailboxes","$getMailboxes","options","reload","$futureMailboxesData","$find","_visitForUnseencount","previousMailbox","find","previousMailboxes","children","all","_visitForExpanded","expandedFolders","indexOf","settings","Mail","ExpandedFolders","isString","fromJson","warn","_visit","allMailboxes","saveState","reduce","$getMailboxByType","type","_find","$getMailboxByPath","path","$newMailbox","name","toString","getTextSignature","$hasCertificate","security","hasCertificate","$certificate","$$certificate","reject","$removeCertificate","updateQuota","percent","description","maxQuota","Math","round","usedSpace","l","formatted","maxMessages","messagesCount","$quota","$newMessage","debug","JSON","stringify","undefined","accountId","mailboxPath","message","$absolutePath","asDraft","accountDefaults","AuxiliaryMailAccounts","alwaysSign","sign","alwaysEncrypt","encrypt","editable","isNew","mailto","isObject","$parseMailto","$addDelegate","user","deferred","defer","param","uid","delegates","resolve","users","status","promise","$removeDelegate","splice","$omit","deep","defaultIdentity","value","key","copy","isReadOnly","pick","isDefault","forceDefaultIdentity","futureMailboxData","$account","init","newMailboxData","create","$unwrap","$rootScope","Acl","PRELOAD","BATCH_DELETE_LIMIT","$$Acl","$query","sort","asc","selectedFolder","$refreshTimeout","$virtualMode","$virtualPath","$searchMode","SortingState","parseInt","constant","LOOKAHEAD","SIZE","createMailboxes","level","isSentFolder","isDraftsFolder","quotas","split","component","asCSSIdentifier","isUndefined","uidsMap","headers","$isLoading","$messages","$visibleMessages","$selectedMessages","$highlightWords","$id","$acl","threaded","$collapsedThreads","threadsCollapsed","$displayName","$isEditable","isEditable","$isSpecial","$icon","$isNoInferiors","isNoInferiors","$shadowData","selectFolder","setSearchMode","searchMode","$lastVisibleIndex","max","$loadMessage","selectedMessages","updateCache","filter","selected","selectedCount","$unselectMessages","isSelectedMessage","messageId","$selectedMessage","selectedMessage","$selectedMessageIndex","hasSelectedMessage","$filter","sortingAttributes","filters","action","labels","searchBy","searchInput","word","cleanedWord","toLowerCase","match","secondFilter","$flaggedOnly","$unseenOnly","$syncToken","syncToken","unseenOnly","flaggedOnly","keys","$filteredLabels","k","f","endIndex","uids","startIndex","loaded","subject","min","loading","futureHeadersData","$unwrapHeaders","flags","isNoSelect","isWritable","getClassName","base","$rename","findParent","parent","parentMailbox","$save","_updateChildren","child","replace","pathRE","oldPath","sibling","localeCompare","RegExp","$compact","$canFolderAs","$setFolderAs","$empty","capitalize","substring","$markAsRead","isread","getLabels","$labels","filteredByLabel","$flagMessages","messages","operation","msgUIDs","forwardMessages","saveSelectedMessages","selectedUIDs","download","exportFolder","filename","open","$delete","$_deleteMessages","firstIndex","forEachRight","selectedIndex","findIndex","updateVisibleMessages","$deleteMessages","batchSize","_deleteMessages","start","end","currentUids","slice","$markOrUnMarkMessagesAsJunk","method","$copyMessages","folder","$moveMessages","$move","parentPath","finally","save","response","error","$reset","childrenArray","collapsedThread","msg","first","collapsed","$broadcast","$futureMailboxData","headersFields","msgObject","hasNewMessages","$topIndex","deleted","j","changed","msgs"Line truncated
{"version":3,"file":"Mailer.services.js","sources":["Mailer/Account.service.js","Mailer/Mailbox.service.js","Mailer/Message.service.js","Mailer/sgImageGallery.service.js","Mailer/VirtualMailbox.service.js","Mailer/MailboxController.js","Mailer/MailboxesController.js","Mailer/MessageController.js","Mailer/MessageEditorController.js","Mailer/sgAccountSection.directive.js","Mailer/sgIMIP.directive.js","Mailer/sgMailboxListItem.directive.js","Mailer/sgMessageListItem.directive.js","Mailer/sgMessageListItemMain.directive.js","Mailer/sgZoomableImage.directive.js"],"names":["Account","futureAccountData","_this","this","then","angular","extend","_","forEach","identities","identity","element","fullName","email","full","signature","textSignature","map","contents","join","trim","$mailboxes","$Mailbox","$unwrapCollection","$q","when","mailboxes","collection","$factory","$timeout","$log","Settings","Resource","Preferences","Mailbox","Message","$$resource","activeUser","$Preferences","$Message","module","e","factory","$findAll","data","$accounts","fetch","o","i","id","refreshUnseenCount","folders","unseenCountFolders","fetchAllUnseenCountFolders","defaults","SOGoMailFetchAllUnseenCountFolders","refreshViewCheck","SOGoRefreshViewCheck","Error","account","$$flattenMailboxes","mailbox","push","includes","isDefined","unseenCount","post","$refreshUnseenCount","cancel","bind","timeInterval","prototype","getLength","$expanded","$flattenMailboxes","length","getItemAtIndex","index","expandedMailboxes","$getMailboxes","options","reload","$futureMailboxesData","$find","_visitForUnseencount","previousMailbox","find","previousMailboxes","children","all","_visitForExpanded","expandedFolders","indexOf","settings","Mail","ExpandedFolders","isString","fromJson","warn","_visit","allMailboxes","saveState","reduce","$getMailboxByType","type","_find","$getMailboxByPath","path","$newMailbox","name","toString","getTextSignature","$hasCertificate","security","hasCertificate","$certificate","$$certificate","reject","$removeCertificate","updateQuota","percent","description","maxQuota","Math","round","usedSpace","l","formatted","maxMessages","messagesCount","$quota","$newMessage","debug","JSON","stringify","undefined","accountId","mailboxPath","message","$absolutePath","asDraft","accountDefaults","AuxiliaryMailAccounts","alwaysSign","sign","alwaysEncrypt","encrypt","editable","isNew","mailto","isObject","$parseMailto","$addDelegate","user","deferred","defer","param","uid","delegates","resolve","users","status","promise","$removeDelegate","splice","$omit","deep","defaultIdentity","value","key","copy","isReadOnly","pick","isDefault","forceDefaultIdentity","futureMailboxData","$account","init","newMailboxData","create","$unwrap","$rootScope","Acl","PRELOAD","BATCH_DELETE_LIMIT","$$Acl","$query","sort","asc","selectedFolder","$refreshTimeout","$virtualMode","$virtualPath","$searchMode","SortingState","parseInt","constant","LOOKAHEAD","SIZE","createMailboxes","level","isSentFolder","isDraftsFolder","quotas","split","component","asCSSIdentifier","isUndefined","uidsMap","headers","$isLoading","$messages","$visibleMessages","$selectedMessages","$highlightWords","$id","$acl","threaded","$collapsedThreads","threadsCollapsed","$displayName","$isEditable","isEditable","$isSpecial","$icon","$isNoInferiors","isNoInferiors","$shadowData","selectFolder","setSearchMode","searchMode","$lastVisibleIndex","max","$loadMessage","selectedMessages","updateCache","filter","selected","selectedCount","$unselectMessages","isSelectedMessage","messageId","$selectedMessage","selectedMessage","$selectedMessageIndex","hasSelectedMessage","$filter","sortingAttributes","filters","action","labels","searchBy","searchInput","word","cleanedWord","toLowerCase","match","secondFilter","$flaggedOnly","$unseenOnly","$syncToken","syncToken","unseenOnly","flaggedOnly","keys","$filteredLabels","k","f","endIndex","uids","startIndex","loaded","subject","min","loading","futureHeadersData","$unwrapHeaders","flags","isNoSelect","isWritable","getClassName","base","$rename","findParent","parent","parentMailbox","$save","_updateChildren","child","replace","pathRE","oldPath","sibling","localeCompare","RegExp","$compact","$canFolderAs","$setFolderAs","$empty","capitalize","substring","$markAsRead","isread","getLabels","$labels","filteredByLabel","$flagMessages","messages","operation","msgUIDs","forwardMessages","saveSelectedMessages","selectedUIDs","download","exportFolder","filename","open","$delete","$_deleteMessages","firstIndex","forEachRight","selectedIndex","findIndex","updateVisibleMessages","$deleteMessages","batchSize","_deleteMessages","start","end","currentUids","slice","$markOrUnMarkMessagesAsJunk","method","$copyMessages","folder","$moveMessages","$move","parentPath","finally","save","response","error","$reset","Object","assign","childrenArray","collapsedThread","msg","first","collapsed","$broadcast","$futureMailboxData","headersFields","msgObject","hasNewMessages","$topIndex","deleted","jLine truncated
@@ -1033,11 +1033,17 @@
*/
Mailbox.prototype.$reset = function(options) {
var _this = this;
var account;
angular.forEach(this.$shadowData, function(value, key) {
delete _this[key];
});
account = Object.assign({}, _this.$account)
angular.extend(this, this.$shadowData);
this.$shadowData = this.$omit();
this.account = account;
if (options && options.unseenCount) {
this.unseenCount = options.unseenCount;
}
if (options && options.filter) {
this.$messages = [];
this.$visibleMessages = [];
@@ -51,8 +51,6 @@
});
$rootScope.$on('resetMailAdvancedSearchPanel', function () {
vm.service.$virtualPath = false;
vm.service.$virtualMode = false;
vm.reset();
});
};
@@ -525,6 +525,8 @@
markInstance.mark(this.$mailbox.getHighlightWords());
data = dom.innerHTML;
dom.remove();
} else if (encodeEntities) {
data = data.encodeEntities();
}
return data;
@@ -549,8 +551,8 @@
Message.prototype.getHighlightFrom = function () {
var i = 0;
for (i = 0; i < this.from.length; i++) {
this.from[i].full = this.highlightSearchTerms(this.from[i].full, false);
this.from[i].name = this.highlightSearchTerms(this.from[i].name, false);
this.from[i].fullHighlighted = this.highlightSearchTerms(this.from[i].full, false);
this.from[i].nameHighlighted = this.highlightSearchTerms(this.from[i].name, false);
}
return this.from;
@@ -53,8 +53,8 @@
/**
* @ngInject
*/
sgMailboxListItemController.$inject = ['$scope', '$rootScope', '$element', '$state', '$timeout', '$mdToast', '$mdPanel', '$mdMedia', '$mdSidenav', 'sgConstant', 'Dialog', 'Mailbox', 'encodeUriFilter'];
function sgMailboxListItemController($scope, $rootScope, $element, $state, $timeout, $mdToast, $mdPanel, $mdMedia, $mdSidenav, sgConstant, Dialog, Mailbox, encodeUriFilter) {
sgMailboxListItemController.$inject = ['$scope', '$rootScope', '$element', '$state', '$timeout', '$mdToast', '$mdPanel', '$mdMedia', '$mdSidenav', 'sgConstant', 'Dialog', 'Mailbox', 'encodeUriFilter', '$window', 'Account'];
function sgMailboxListItemController($scope, $rootScope, $element, $state, $timeout, $mdToast, $mdPanel, $mdMedia, $mdSidenav, sgConstant, Dialog, Mailbox, encodeUriFilter, $window, Account) {
var $ctrl = this;
@@ -84,15 +84,24 @@
this.selectFolder = function($event) {
$rootScope.$broadcast('resetMailAdvancedSearchPanel'); // Reset advanced search panel (broadcast event to MailboxesController)
if (this.editMode || this.mailbox == Mailbox.selectedFolder || this.mailbox.isNoSelect())
return;
this.mailbox.setHighlightWords([]);
this.mailbox.setHighlightWords([]);
if (Mailbox.selectedFolder) {
Mailbox.$virtualMode = false;
Mailbox.selectedFolder.$reset({ filter: true });
if (Mailbox.$virtualMode) {
Mailbox.$virtualMode = false;
Mailbox.$virtualPath = false;
$rootScope.$broadcast('resetMailAdvancedSearchPanel'); // Reset advanced search panel (broadcast event to MailboxesController)
if (Mailbox.selectedFolder.$mailboxes && Mailbox.selectedFolder.$mailboxes.length > 0) {
Mailbox.selectedFolder.$reset({ filter: true, unseenCount: Mailbox.selectedFolder.$mailboxes[0].unseenCount });
}
} else {
Mailbox.selectedFolder.$reset({ filter: true, unseenCount: Mailbox.selectedFolder.unseenCount });
}
}
this.accountController.selectFolder(this);
if ($event) {
$state.go('mail.account.mailbox', {