mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Improved reviveFromJson() for *Model
This commit is contained in:
parent
f4b2fddf5e
commit
76c4f62186
18 changed files with 226 additions and 341 deletions
|
|
@ -10,16 +10,7 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
|
|||
* @returns {AttachmentCollectionModel}
|
||||
*/
|
||||
static reviveFromJson(items) {
|
||||
let cb = attachment => AttachmentModel.reviveFromJson(attachment),
|
||||
result = super.reviveFromJson(items, cb);
|
||||
if (!result) {
|
||||
result = new AttachmentCollectionModel;
|
||||
Array.isArray(items) && items.forEach(attachment => {
|
||||
attachment = cb(attachment);
|
||||
attachment && result.push(attachment);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
return super.reviveFromJson(items, attachment => AttachmentModel.reviveFromJson(attachment));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue