Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
feature(Felamimail): parse addresslist in client
Browse files Browse the repository at this point in the history
Change-Id: Icfd3dd9f26ea3b47cb0cdf2185c637f85f66558a
Reviewed-on: http://gerrit.tine20.com/customers/17993
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
  • Loading branch information
corneliusweiss authored and pschuele committed Nov 30, 2020
1 parent d72341f commit aa6354d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tine20/Felamimail/js/RecipientGrid.js
Expand Up @@ -205,11 +205,38 @@ Tine.Felamimail.RecipientGrid = Ext.extend(Ext.grid.EditorGridPanel, {

this.searchCombo = new Tine.Felamimail.ContactSearchCombo({
lazyInit: false,
lastInputEventValue: '',
listeners: {
scope: this,
specialkey: this.onSearchComboSpecialkey,
select: this.onSearchComboSelect,
render: (combo) => {
combo.getEl().on('input', (e, dom) => {
const value = this.searchCombo.getValue();
if (Math.abs(value.length - this.searchCombo.lastInputEventValue.length) > 5 && (value.match(/@/g) || []).length > 1) {
import(/* webpackChunkName: "Tinebase/js/email-addresses" */ 'email-addresses').then((addrs) => {
if (!this.loadMask) {
this.loadMask = new Ext.LoadMask(Ext.getBody(), {msg: app.i18n._('Loading Mail Addresses')});
}
this.loadMask.show();

const parsed = addrs.parseAddressList(value.replace(';', ','));
const emails = _.map(parsed, (p) => { return (p.name ? `"${p.name}" <${p.address}>` : p.address) });

this._addRecipients(emails, this.activeEditor ? this.activeEditor.record.data.type : this.lastActiveEditor.record.data.type);
this.setFixedHeight(false);
this.ownerCt.doLayout();
this.store.remove(this.activeEditor ? this.activeEditor.record : this.lastEditedRecord);
this.addRowAndDoLayout(this.activeEditor ? this.activeEditor.record : this.lastEditedRecord);
}).then(() => {
this.loadMask.hide();
});
}
this.searchCombo.lastInputEventValue = value;
})
},
blur: function(combo) {
this.lastInputEventValue = '';
Tine.log.debug('Tine.Felamimail.MessageEditDialog::onSearchComboBlur()');
this.getView().el.select('.x-grid3-td-address-editing').removeClass('x-grid3-td-address-editing');
// need to update record because it might not be updated otherwise (for example: delete value, click into next row or subject)
Expand Down
10 changes: 10 additions & 0 deletions tine20/Tinebase/js/npm-shrinkwrap.json

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

2 changes: 2 additions & 0 deletions tine20/Tinebase/js/package.json
Expand Up @@ -26,6 +26,7 @@
"cytoscape": "^3.15.0",
"cytoscape-dagre": "^2.2.2",
"director": "^1.2.8",
"email-addresses": "^3.1.0",
"format-message": "^6.2.3",
"graphlib": "^2.1.8",
"hammerjs": "^2.0.8",
Expand All @@ -43,6 +44,7 @@
"postal.request-response": "github:tine20/postal.request-response",
"postal.xwindow": "github:tine20/postal.xwindow",
"promises-to-retry": "^1.3.0",
"s": "^1.0.0",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"store2": "^2.11.2",
Expand Down

0 comments on commit aa6354d

Please sign in to comment.