Skip to content

Commit 7ce140b

Browse files
refactor: update views and models with recently added fields
refs conjoon/conjoon#23
1 parent 26da32a commit 7ce140b

File tree

4 files changed

+74
-19
lines changed

4 files changed

+74
-19
lines changed

classic/src/view/mail/account/MailAccountView.js

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -321,6 +321,31 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountView", {
321321
value: "{mailAccount.outbox_password}"
322322
}
323323
}]}]
324+
}, {
325+
xtype: "fieldset",
326+
title: "Subscriptions",
327+
listeners: {
328+
// fix for tagfield growing horizontally
329+
afterrender: cmp => cmp.setWidth(1)
330+
},
331+
items: [{
332+
xtype: "tagfield",
333+
flex: 1,
334+
labelWidth: 160,
335+
fieldLabel: " ",
336+
name: "subscriptions",
337+
queryMode: "local",
338+
forceSelection: false,
339+
triggerOnClick: false,
340+
createNewOnEnter: true,
341+
hideTrigger: true,
342+
createNewOnBlur: true,
343+
bind: {
344+
value: "{mailAccount.subscriptions}",
345+
store: "{subscriptionStore}"
346+
}
347+
}]
348+
324349
}]
325350
}],
326351

src/view/mail/account/MailAccountViewModel.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -57,6 +57,12 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountViewModel", {
5757
mailAccount: null
5858
},
5959

60+
stores: {
61+
subscriptionStore: {
62+
data: []
63+
}
64+
},
65+
6066
formulas: {
6167

6268
/**
@@ -266,6 +272,7 @@ Ext.define("conjoon.cn_mail.view.mail.account.MailAccountViewModel", {
266272
"inbox_password",
267273

268274
"active",
275+
"subscriptions",
269276

270277
"outbox_type",
271278
"outbox_address",

tests/classic/src/view/mail/account/MailAccountViewTest.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -34,14 +34,17 @@ StartTest(t => {
3434

3535
inbox_type: "inbox_type",
3636
inbox_address: "inbox_address",
37-
inbox_port: "inbox_port",
37+
inbox_port: 8080,
3838
inbox_ssl: true,
3939
inbox_user: "inbox_user",
4040
inbox_password: "inbox_password",
4141

42+
active: true,
43+
subscriptions: ["INBOX"],
44+
4245
outbox_type: "outbox_type",
4346
outbox_address: "outbox_address",
44-
outbox_port: "outbox_port",
47+
outbox_port: 8088,
4548
outbox_secure: "tsl",
4649
outbox_user: "outbox_user",
4750
outbox_password: "outbox_password"
@@ -178,10 +181,21 @@ StartTest(t => {
178181
t.expect(data["replyTo"].address).toBe(values[i]);
179182
break;
180183

181-
case "inactive":
182-
t.expect(data["inactive"]).toBe(!values[i]);
184+
case "active":
185+
t.expect(data["active"]).toBe(values[i]);
186+
break;
187+
188+
case "inbox_port":
189+
case "outbox_port":
190+
t.expect(data[i]).toBe(parseInt(values[i]));
183191
break;
184192

193+
194+
case "subscriptions":
195+
t.expect(data["subscriptions"]).toEqual(["INBOX"]);
196+
break;
197+
198+
185199
default:
186200
t.expect(data[i]).toBe(values[i]);
187201
break;

tests/src/view/mail/account/MailAccountViewModelTest.js

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -40,14 +40,17 @@ StartTest(async t => {
4040

4141
inbox_type: "inbox_type",
4242
inbox_address: "inbox_address",
43-
inbox_port: "inbox_port",
43+
inbox_port: 8080,
4444
inbox_ssl: true,
4545
inbox_user: "inbox_user",
4646
inbox_password: "inbox_password",
4747

48+
active: false,
49+
subscriptions: ["INBOX"],
50+
4851
outbox_type: "outbox_type",
4952
outbox_address: "outbox_address",
50-
outbox_port: "outbox_port",
53+
outbox_port: 8088,
5154
outbox_secure: "ssl",
5255
outbox_user: "outbox_user",
5356
outbox_password: "outbox_password"
@@ -317,6 +320,9 @@ StartTest(async t => {
317320
"inbox_user",
318321
"inbox_password",
319322

323+
"subscriptions",
324+
"active",
325+
320326
"outbox_type",
321327
"outbox_address",
322328
"outbox_port",
@@ -337,6 +343,16 @@ StartTest(async t => {
337343
case "replyTo":
338344
record.data[fields[i]] = {name: Ext.id(), address: Ext.id()};
339345
break;
346+
case "subscriptions":
347+
record.data[fields[i]] = ["INBOX"];
348+
break;
349+
case "active":
350+
record.data[fields[i]] = true;
351+
break;
352+
case "inbox_port":
353+
case "outbox_port":
354+
record.data[fields[i]] = parseInt(Ext.id().split("-").pop());
355+
break;
340356

341357
default:
342358
record.data[fields[i]] = fields[i].indexOf("_ssl") !== -1 ? true : Ext.id();
@@ -363,25 +379,18 @@ StartTest(async t => {
363379

364380
switch (fields[i]) {
365381
case "from":
366-
367-
t.expect(record.data[fields[i]]).toEqual(
368-
viewModel.sourceMailAccounts[id].data[fields[i]]
369-
);
370-
break;
371-
372382
case "replyTo":
383+
case "subscriptions":
373384
t.expect(record.data[fields[i]]).toEqual(
374385
viewModel.sourceMailAccounts[id].data[fields[i]]
375386
);
376387
break;
377388

389+
378390
default:
379391
t.expect(record.data[fields[i]]).toBe(viewModel.sourceMailAccounts[id].data[fields[i]]);
380392
break;
381-
382393
}
383-
384-
385394
}
386395

387396
t.expect(viewModel.sourceMailAccounts[id].modified).toBeFalsy();

0 commit comments

Comments
 (0)