mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
merge all Model JSON @Object parsers into a reviveFromJson()
This commit is contained in:
parent
76648f04ae
commit
15e07a73e9
18 changed files with 378 additions and 411 deletions
|
|
@ -468,7 +468,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
|
||||
/**
|
||||
* @param {string} sResult
|
||||
* @param {AjaxJsonDefaultResponse} oData
|
||||
* @param {FetchJsonDefaultResponse} oData
|
||||
*/
|
||||
deleteResponse(sResult, oData) {
|
||||
if (500 < (StorageResultType.Success === sResult && oData && oData.Time ? pInt(oData.Time) : 0)) {
|
||||
|
|
@ -570,13 +570,11 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.List) {
|
||||
if (Array.isNotEmpty(data.Result.List)) {
|
||||
list = data.Result.List.map(item => {
|
||||
const contact = new ContactModel();
|
||||
return contact.parse(item) ? contact : null;
|
||||
data.Result.List.forEach(item => {
|
||||
item = ContactModel.reviveFromJson(item);
|
||||
item && list.push(item);
|
||||
});
|
||||
|
||||
list = list.filter(v => v);
|
||||
|
||||
count = pInt(data.Result.Count);
|
||||
count = 0 < count ? count : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import Remote from 'Remote/User/Fetch';
|
|||
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
import { TemplateModel } from 'Model/Template';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Template',
|
||||
|
|
@ -133,8 +134,7 @@ class TemplatePopupView extends AbstractViewNext {
|
|||
if (
|
||||
StorageResultType.Success === result &&
|
||||
data &&
|
||||
data.Result &&
|
||||
'Object/Template' === data.Result['@Object'] &&
|
||||
TemplateModel.validJson(data.Result) &&
|
||||
null != data.Result.Body
|
||||
) {
|
||||
template.body = data.Result.Body;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue