diff --git a/src/model/mail/account/MailAccount.js b/src/model/mail/account/MailAccount.js index 9b7420fc..b03ea74d 100644 --- a/src/model/mail/account/MailAccount.js +++ b/src/model/mail/account/MailAccount.js @@ -93,7 +93,12 @@ Ext.define("conjoon.cn_mail.model.mail.account.MailAccount", { }, { name: "outbox_secure", type: "string" - }], + }].map(field => { + if (!["id", "type"].includes(field.name)) { + field.mapping = `attributes.${field.name}`; + } + return field; + }), /** * Overriden to make sure we can specify class statics for values of diff --git a/tests/src/model/mail/account/MailAccountTest.js b/tests/src/model/mail/account/MailAccountTest.js index a23e5cd3..b956d1df 100644 --- a/tests/src/model/mail/account/MailAccountTest.js +++ b/tests/src/model/mail/account/MailAccountTest.js @@ -1,7 +1,7 @@ /** * conjoon * extjs-app-webmail - * Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail + * Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -91,4 +91,14 @@ StartTest(t => { }); + t.it("test mappings php-lib-conjoon#8", t => { + + model.fields.forEach(field => { + if (field.getName() !== "id" && Object.prototype.hasOwnProperty.call(field, "definedBy")) { + t.expect(field.getMapping()).toBe(`attributes.${field.getName()}`); + } + }); + + }); + });