mirror of
				https://github.com/Crazyco-xyz/48hr.email.git
				synced 2025-11-04 07:16:32 +01:00 
			
		
		
		
	Fix the fix that fixes the hotfix for fixing time - or something
This commit is contained in:
		
							parent
							
								
									e99a8b55e0
								
							
						
					
					
						commit
						80d8ecfad2
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -201,17 +201,15 @@ class ImapService extends EventEmitter {
 | 
			
		|||
	 */
 | 
			
		||||
	async deleteOldMails(deleteMailsBefore) {
 | 
			
		||||
		let uids = []
 | 
			
		||||
		if (helper.moreThanOneDay(moment(), deleteMailsBefore)) {
 | 
			
		||||
		//fetch mails from date +1day (calculated in MS) to avoid wasting resources and to fix imaps missing time-awareness
 | 
			
		||||
		if (helper.moreThanOneDay(moment() + 24 * 60 * 60 * 1000, deleteMailsBefore)) {
 | 
			
		||||
			uids = await this._searchWithoutFetch([
 | 
			
		||||
				['!DELETED'],
 | 
			
		||||
				['BEFORE', deleteMailsBefore]
 | 
			
		||||
			])
 | 
			
		||||
		} else {
 | 
			
		||||
			//fetch mails from date -1day (calculated in MS) to avoid wasting resources
 | 
			
		||||
			deleteMailsBefore = new Date(moment() - 24 * 60 * 60 * 1000)
 | 
			
		||||
			uids = await this._searchWithoutFetch([
 | 
			
		||||
				['!DELETED'],
 | 
			
		||||
				['BEFORE', deleteMailsBefore]
 | 
			
		||||
			])
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -220,8 +218,8 @@ class ImapService extends EventEmitter {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		const DeleteOlderThan = helper.purgeTimeStamp()
 | 
			
		||||
 | 
			
		||||
		const uidsWithHeaders = await this._getMailHeaders(uids)
 | 
			
		||||
 | 
			
		||||
		uidsWithHeaders.forEach(mail => {
 | 
			
		||||
			if (mail['attributes'].date > DeleteOlderThan || this.config.email.examples.uids.includes(parseInt(mail['attributes'].uid))) {
 | 
			
		||||
				uids = uids.filter(uid => uid !== mail['attributes'].uid)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue