Skip to content

Commit

Permalink
refactor: add mixins to make sure cn_mail does not send additional he…
Browse files Browse the repository at this point in the history
…ader

imapuser expects no additional headers with extjs-app-webmail#255

refs conjoon/extjs-app-webmail#255
  • Loading branch information
ThorstenSuckow committed Nov 19, 2022
1 parent f0acfb2 commit 5969e5f
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* conjoon
* extjs-app-imapuser
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-imapuser
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
57 changes: 57 additions & 0 deletions overrides/conjoon.cn_mail.data.mail.HeaderMixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* conjoon
* extjs-app-imapuser
* Copyright (C) 2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/**
*
*
*/
Ext.define("conjoon.cn_imapuser.overrides.conjoon.cn_mail.data.mail.HeaderMixin", {

override: "conjoon.cn_mail.data.mail.HeaderMixin",

getAdditionalHeaders (url, cfg) {
return {};
},


getConnectionHeaders (url) {
return {};
},

getAuthHeaders (url, type) {
return {};
},


/**
* @param url
* @returns {conjoon.cn_mail.model.mail.folder.MailFolder|null}
* @private
*/
getAccountForUrl (url) {
throw new Error("Runtime Exception: getAccoutnUrl should not be called from extern.");
}

});
41 changes: 41 additions & 0 deletions overrides/conjoon.dev.cn_mailsim.data.HeaderMixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* conjoon
* extjs-app-imapuser
* Copyright (C) 2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/**
* @inheritdoc
*/
Ext.define("conjoon.cn_imapuser.overrides.conjoon.dev.cn_mailsim.data.HeaderMixin", {

override: "conjoon.dev.cn_mailsim.data.HeaderMixin",

checkHeader: function (xhr) {
return true;
},


matchAccountInfoForCurrentRequest (mailAccountId) {
return true;
}
});
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"@commitlint/config-conventional": "^13.2.0",
"@conjoon/extjs-app-webmail": "^0.3",
"@conjoon/extjs-dev-imapusersim": "^1.0.4",
"@conjoon/extjs-dev-webmailsim": "^0.1.4",
"@conjoon/extjs-theme-material": "^0.2.3",
"@coon-js/bundleme": "^0.3.1",
"@coon-js/extjs-app-user": "^0.1.7",
Expand Down
35 changes: 6 additions & 29 deletions tests/groups.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,12 @@

export default [{
group: "overrides",
items: [{
group: "coon",
items: [{
group: "user",
items: [{
group: "view",
items: [{
group: "authentication",
items: [
"overrides/coon/user/view/authentication/AuthFormTest.js"
]
}]
}]
}]
},{
group: "conjoon",
items: [{
group: "cn_mail",
items: [{
group: "data",
items: [{
group: "mail",
items: [
"overrides/conjoon/cn_mail/data/mail/account/proxy/MailAccountProxyTest.js"
]
}]
}]
}]
}]
items: [
"overrides/coon.user.view.authentication.AuthFormTest.js",
"overrides/conjoon.cn_mail.data.mail.account.proxy.MailAccountProxyTest.js",
"overrides/conjoon.dev.cn_mailsim.data.HeaderMixinTest.js",
"overrides/conjoon.cn_mail.data.mail.HeaderMixinTest.js"
]
}, {
group: "universal",
items: [{
Expand Down
49 changes: 49 additions & 0 deletions tests/overrides/conjoon.cn_mail.data.mail.HeaderMixinTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* conjoon
* extjs-app-imapuser
* Copyright (C) 2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

StartTest(t => {


t.requireOk(
"conjoon.cn_mail.data.mail.HeaderMixin",
"conjoon.cn_imapuser.overrides.conjoon.cn_mail.data.mail.HeaderMixin", () => {

const makeMixin = () => Ext.create("conjoon.cn_mail.data.mail.HeaderMixin");

t.it("getAdditionalHeaders()", t => {
t.expect(makeMixin().getAdditionalHeaders()).toEqual({});
});

t.it("getConnectionHeaders()", t => {
t.expect(makeMixin().getConnectionHeaders()).toEqual({});
});

t.it("getAuthHeaders()", t => {
t.expect(makeMixin().getAuthHeaders()).toEqual({});
});

});

});
46 changes: 46 additions & 0 deletions tests/overrides/conjoon.dev.cn_mailsim.data.HeaderMixinTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* conjoon
* extjs-app-imapuser
* Copyright (C) 2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-imapuser
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

StartTest(t => {


t.requireOk(
"conjoon.cn_imapuser.overrides.conjoon.dev.cn_mailsim.data.HeaderMixin",
"conjoon.dev.cn_mailsim.data.HeaderMixin", () => {

const makeMixin = () => Ext.create("conjoon.dev.cn_mailsim.data.HeaderMixin");

t.it("checkHeader()", t => {
t.expect(makeMixin().checkHeader()).toBe(true);
});


t.it("matchAccountInfoForCurrentRequest()", t => {
t.expect(makeMixin().matchAccountInfoForCurrentRequest()).toBe(true);
});

});

});
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ StartTest(t => {

});

});
});
9 changes: 8 additions & 1 deletion tests/tests.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ export default {

timeout: 750,


loaderPath: {

"conjoon.cn_imapuser": "../src",

"conjoon.cn_imapuser.overrides.conjoon": "../overrides/conjoon",
"conjoon.cn_imapuser.overrides.coon.user.view.authentication.AuthForm": "../classic/overrides/coon.user.view.authentication.AuthForm.js",
"conjoon.cn_imapuser.overrides.conjoon.cn_mail.data.mail.account.proxy.MailAccountProxy": "../overrides/conjoon.cn_mail.data.mail.account.proxy.MailAccountProxy.js",
"conjoon.cn_imapuser.overrides.conjoon.dev.cn_mailsim.data.HeaderMixin": "../overrides/conjoon.dev.cn_mailsim.data.HeaderMixin.js",
"conjoon.cn_imapuser.overrides.conjoon.cn_mail.data.mail.HeaderMixin": "../overrides/conjoon.cn_mail.data.mail.HeaderMixin.js",

"conjoon.cn_mail.data.mail.HeaderMixin": "../../node_modules/@conjoon/extjs-app-webmail/src/data/mail/HeaderMixin.js",
"conjoon.dev.cn_mailsim.data.HeaderMixin": "../../node_modules/@conjoon/extjs-dev-webmailsim/src/data/HeaderMixin.js",

"coon.user.view.authentication.AuthWindow": "../../node_modules/@coon-js/extjs-app-user/src/view/authentication/AuthWindow.js",

Expand Down

0 comments on commit 5969e5f

Please sign in to comment.