mirror of
				https://github.com/the-djmaze/snappymail.git
				synced 2025-11-01 00:46:09 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			683 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			683 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { AbstractCollectionModel } from 'Model/AbstractCollection';
 | |
| import { AttachmentModel } from 'Model/Attachment';
 | |
| 
 | |
| 'use strict';
 | |
| 
 | |
| export class AttachmentCollectionModel extends AbstractCollectionModel
 | |
| {
 | |
| 	/**
 | |
| 	 * @param {?Array} json
 | |
| 	 * @returns {AttachmentCollectionModel}
 | |
| 	 */
 | |
| 	static reviveFromJson(items) {
 | |
| 		return super.reviveFromJson(items, attachment => AttachmentModel.reviveFromJson(attachment));
 | |
| 	}
 | |
| 
 | |
| 	/**
 | |
| 	 * @returns {boolean}
 | |
| 	 */
 | |
| 	hasVisible() {
 | |
| 		return !!this.find(item => !item.isLinked);
 | |
| 	}
 | |
| 
 | |
| 	/**
 | |
| 	 * @param {string} cid
 | |
| 	 * @returns {*}
 | |
| 	 */
 | |
| 	findByCid(cid) {
 | |
| 		cid = cid.replace(/^<+|>+$/, '');
 | |
| 		return this.find(item => cid === item.cidWithoutTags);
 | |
| 	}
 | |
| }
 |