mirror of
https://github.com/moparisthebest/mail
synced 2025-02-24 14:51:55 -05:00
commit
efdc78fc75
12
package.json
12
package.json
@ -8,7 +8,17 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/whiteout-io/mail-html5.git"
|
"url": "https://github.com/whiteout-io/mail-html5.git"
|
||||||
},
|
},
|
||||||
"keywords": ["email", "mail", "client", "app", "openpgp", "pgp", "gpg", "imap", "smtp"],
|
"keywords": [
|
||||||
|
"email",
|
||||||
|
"mail",
|
||||||
|
"client",
|
||||||
|
"app",
|
||||||
|
"openpgp",
|
||||||
|
"pgp",
|
||||||
|
"gpg",
|
||||||
|
"imap",
|
||||||
|
"smtp"
|
||||||
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,8 @@ requirejs([
|
|||||||
'fastclick',
|
'fastclick',
|
||||||
'angularRoute',
|
'angularRoute',
|
||||||
'angularAnimate',
|
'angularAnimate',
|
||||||
'ngInfiniteScroll'
|
'ngInfiniteScroll',
|
||||||
|
'ngTagsInput'
|
||||||
], function(
|
], function(
|
||||||
angular,
|
angular,
|
||||||
DialogCtrl,
|
DialogCtrl,
|
||||||
@ -70,7 +71,8 @@ requirejs([
|
|||||||
'login-new-device',
|
'login-new-device',
|
||||||
'privatekey-upload',
|
'privatekey-upload',
|
||||||
'popover',
|
'popover',
|
||||||
'infinite-scroll'
|
'infinite-scroll',
|
||||||
|
'ngTagsInput'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// set router paths
|
// set router paths
|
||||||
|
@ -14,14 +14,13 @@ define(function(require) {
|
|||||||
// Controller
|
// Controller
|
||||||
//
|
//
|
||||||
|
|
||||||
var WriteCtrl = function($scope, $filter) {
|
var WriteCtrl = function($scope, $filter, $q) {
|
||||||
pgp = appController._pgp;
|
pgp = appController._pgp;
|
||||||
auth = appController._auth;
|
auth = appController._auth;
|
||||||
emailDao = appController._emailDao;
|
emailDao = appController._emailDao;
|
||||||
outbox = appController._outboxBo;
|
outbox = appController._outboxBo;
|
||||||
keychainDao = appController._keychain;
|
keychainDao = appController._keychain;
|
||||||
|
|
||||||
|
|
||||||
// set default value so that the popover height is correct on init
|
// set default value so that the popover height is correct on init
|
||||||
$scope.keyId = 'XXXXXXXX';
|
$scope.keyId = 'XXXXXXXX';
|
||||||
|
|
||||||
@ -55,21 +54,16 @@ define(function(require) {
|
|||||||
|
|
||||||
function resetFields() {
|
function resetFields() {
|
||||||
$scope.writerTitle = 'New email';
|
$scope.writerTitle = 'New email';
|
||||||
$scope.to = [{
|
$scope.to = [];
|
||||||
address: ''
|
|
||||||
}];
|
|
||||||
$scope.showCC = false;
|
$scope.showCC = false;
|
||||||
$scope.cc = [{
|
$scope.cc = [];
|
||||||
address: ''
|
|
||||||
}];
|
|
||||||
$scope.showBCC = false;
|
$scope.showBCC = false;
|
||||||
$scope.bcc = [{
|
$scope.bcc = [];
|
||||||
address: ''
|
|
||||||
}];
|
|
||||||
$scope.subject = '';
|
$scope.subject = '';
|
||||||
$scope.body = '';
|
$scope.body = '';
|
||||||
$scope.ciphertextPreview = '';
|
$scope.ciphertextPreview = '';
|
||||||
$scope.attachments = [];
|
$scope.attachments = [];
|
||||||
|
$scope.addressBookCache = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportBug() {
|
function reportBug() {
|
||||||
@ -218,17 +212,13 @@ define(function(require) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is fired when editing the email address headers. It checks is space is pressed and if so, creates a new address field.
|
* Verify email address and fetch its public key
|
||||||
*/
|
|
||||||
$scope.onAddressUpdate = function(field, index) {
|
|
||||||
var recipient = field[index];
|
|
||||||
$scope.verify(recipient);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify and email address and fetch its public key
|
|
||||||
*/
|
*/
|
||||||
$scope.verify = function(recipient) {
|
$scope.verify = function(recipient) {
|
||||||
|
if (!recipient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// set display to insecure while fetching keys
|
// set display to insecure while fetching keys
|
||||||
recipient.key = undefined;
|
recipient.key = undefined;
|
||||||
recipient.secure = false;
|
recipient.secure = false;
|
||||||
@ -241,42 +231,32 @@ define(function(require) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if to address is contained in known public keys
|
// keychainDao is undefined in local dev environment
|
||||||
// when we write an email, we always need to work with the latest keys available
|
if (keychainDao) {
|
||||||
keychainDao.refreshKeyForUserId(recipient.address, function(err, key) {
|
// check if to address is contained in known public keys
|
||||||
if (err) {
|
// when we write an email, we always need to work with the latest keys available
|
||||||
$scope.onError(err);
|
keychainDao.refreshKeyForUserId(recipient.address, function(err, key) {
|
||||||
return;
|
if (err) {
|
||||||
}
|
$scope.onError(err);
|
||||||
|
return;
|
||||||
if (key) {
|
|
||||||
// compare again since model could have changed during the roundtrip
|
|
||||||
var matchingUserId = _.findWhere(key.userIds, {
|
|
||||||
emailAddress: recipient.address
|
|
||||||
});
|
|
||||||
// compare either primary userId or (if available) multiple IDs
|
|
||||||
if (key.userId === recipient.address || matchingUserId) {
|
|
||||||
recipient.key = key;
|
|
||||||
recipient.secure = true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$scope.checkSendStatus();
|
if (key) {
|
||||||
$scope.$digest();
|
// compare again since model could have changed during the roundtrip
|
||||||
});
|
var matchingUserId = _.findWhere(key.userIds, {
|
||||||
};
|
emailAddress: recipient.address
|
||||||
|
});
|
||||||
|
// compare either primary userId or (if available) multiple IDs
|
||||||
|
if (key.userId === recipient.address || matchingUserId) {
|
||||||
|
recipient.key = key;
|
||||||
|
recipient.secure = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.getKeyId = function(recipient) {
|
$scope.checkSendStatus();
|
||||||
$scope.keyId = 'Key not found for that user.';
|
$scope.$digest();
|
||||||
|
});
|
||||||
if (!recipient.key) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var fpr = pgp.getFingerprint(recipient.key.publicKey);
|
|
||||||
var formatted = fpr.slice(32);
|
|
||||||
|
|
||||||
$scope.keyId = formatted;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -418,6 +398,52 @@ define(function(require) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tag input & Autocomplete
|
||||||
|
//
|
||||||
|
|
||||||
|
$scope.tagStyle = function(recipient) {
|
||||||
|
var classes = ['label'];
|
||||||
|
if (recipient.secure === false) {
|
||||||
|
classes.push('label-primary');
|
||||||
|
}
|
||||||
|
return classes;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.lookupAddressBook = function(query) {
|
||||||
|
var deferred = $q.defer();
|
||||||
|
|
||||||
|
if (!$scope.addressBookCache) {
|
||||||
|
// populate address book cache
|
||||||
|
keychainDao.listLocalPublicKeys(function(err, keys) {
|
||||||
|
if (err) {
|
||||||
|
$scope.onError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.addressBookCache = keys.map(function(key) {
|
||||||
|
return {
|
||||||
|
address: key.userId
|
||||||
|
};
|
||||||
|
});
|
||||||
|
filter();
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
// query address book cache
|
||||||
|
function filter() {
|
||||||
|
var addresses = $scope.addressBookCache.filter(function(i) {
|
||||||
|
return i.address.indexOf(query) !== -1;
|
||||||
|
});
|
||||||
|
deferred.resolve(addresses);
|
||||||
|
}
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Helpers
|
// Helpers
|
||||||
//
|
//
|
||||||
@ -489,138 +515,28 @@ define(function(require) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
ngModule.directive('autoSize', function($parse) {
|
ngModule.directive('focusInput', function($timeout, $parse) {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
//scope: true, // optionally create a child scope
|
||||||
link: function(scope, elm, attrs) {
|
|
||||||
// resize text input depending on value length
|
|
||||||
var model = $parse(attrs.autoSize);
|
|
||||||
scope.$watch(model, function(value) {
|
|
||||||
var width;
|
|
||||||
|
|
||||||
if (!value || value.length < 12) {
|
|
||||||
width = (14 * 8) + 'px';
|
|
||||||
} else {
|
|
||||||
width = ((value.length + 2) * 8) + 'px';
|
|
||||||
}
|
|
||||||
|
|
||||||
elm.css('width', width);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
function addInput(field, scope) {
|
|
||||||
scope.$apply(function() {
|
|
||||||
field.push({
|
|
||||||
address: ''
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeInput(field, index, scope) {
|
|
||||||
scope.$apply(function() {
|
|
||||||
field.splice(index, 1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkForEmptyInput(field) {
|
|
||||||
var emptyFieldExists = false;
|
|
||||||
field.forEach(function(recipient) {
|
|
||||||
if (!recipient.address) {
|
|
||||||
emptyFieldExists = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return emptyFieldExists;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanupEmptyInputs(field, scope) {
|
|
||||||
scope.$apply(function() {
|
|
||||||
for (var i = field.length - 2; i >= 0; i--) {
|
|
||||||
if (!field[i].address) {
|
|
||||||
field.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function focusInput(fieldName, index) {
|
|
||||||
var fieldId = fieldName + (index);
|
|
||||||
var fieldEl = document.getElementById(fieldId);
|
|
||||||
if (fieldEl) {
|
|
||||||
fieldEl.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngModule.directive('field', function() {
|
|
||||||
return {
|
|
||||||
scope: true,
|
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
element.on('click', function(e) {
|
var model = $parse(attrs.focusInput);
|
||||||
if (e.target.nodeName === 'INPUT') {
|
scope.$watch(model, function(value) {
|
||||||
return;
|
if (value === true) {
|
||||||
|
$timeout(function() {
|
||||||
|
element.find('input').first().focus();
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
var fieldName = attrs.field;
|
|
||||||
var field = scope[fieldName];
|
|
||||||
|
|
||||||
if (!checkForEmptyInput(field)) {
|
|
||||||
// create new field input if no empy one exists
|
|
||||||
addInput(field, scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
// focus on last input when clicking on field
|
|
||||||
focusInput(fieldName, field.length - 1);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
ngModule.directive('addressInput', function() {
|
ngModule.directive('focusInputOnClick', function() {
|
||||||
return {
|
return {
|
||||||
scope: true,
|
//scope: true, // optionally create a child scope
|
||||||
link: function(scope, elm, attrs) {
|
link: function(scope, element) {
|
||||||
// get prefix for id
|
element.on('click', function() {
|
||||||
var fieldName = attrs.addressInput;
|
element.find('input').first().focus();
|
||||||
var field = scope[fieldName];
|
|
||||||
var index = parseInt(attrs.id.replace(fieldName, ''), 10);
|
|
||||||
|
|
||||||
elm.on('blur', function() {
|
|
||||||
if (!checkForEmptyInput(field)) {
|
|
||||||
// create new field input
|
|
||||||
addInput(field, scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanupEmptyInputs(field, scope);
|
|
||||||
});
|
|
||||||
|
|
||||||
elm.on('keydown', function(e) {
|
|
||||||
var code = e.keyCode;
|
|
||||||
var address = elm[0].value;
|
|
||||||
|
|
||||||
if (code === 32 || code === 188 || code === 186) {
|
|
||||||
// catch space, comma, semicolon
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
// add next field only if current input is not empty
|
|
||||||
if (address) {
|
|
||||||
// create new field input
|
|
||||||
addInput(field, scope);
|
|
||||||
|
|
||||||
// find next input and focus
|
|
||||||
focusInput(fieldName, index + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ((code === 8 || code === 46) && !address && field.length > 1) {
|
|
||||||
// backspace, delete on empty input
|
|
||||||
// remove input
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
removeInput(field, index, scope);
|
|
||||||
|
|
||||||
// focus on previous id
|
|
||||||
focusInput(fieldName, index - 1);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
5
src/lib/ngtagsinput/ng-tags-input.min.js
vendored
Executable file
5
src/lib/ngtagsinput/ng-tags-input.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@ -16,6 +16,7 @@
|
|||||||
angularRoute: 'angular/angular-route.min',
|
angularRoute: 'angular/angular-route.min',
|
||||||
angularAnimate: 'angular/angular-animate.min',
|
angularAnimate: 'angular/angular-animate.min',
|
||||||
ngInfiniteScroll: 'ng-infinite-scroll.min',
|
ngInfiniteScroll: 'ng-infinite-scroll.min',
|
||||||
|
ngTagsInput: 'ngtagsinput/ng-tags-input.min',
|
||||||
uuid: 'uuid/uuid',
|
uuid: 'uuid/uuid',
|
||||||
forge: 'forge/forge.min',
|
forge: 'forge/forge.min',
|
||||||
punycode: 'punycode.min',
|
punycode: 'punycode.min',
|
||||||
@ -45,6 +46,10 @@
|
|||||||
exports: 'angular',
|
exports: 'angular',
|
||||||
deps: ['jquery', 'angular']
|
deps: ['jquery', 'angular']
|
||||||
},
|
},
|
||||||
|
ngTagsInput: {
|
||||||
|
exports: 'angular',
|
||||||
|
deps: ['angular']
|
||||||
|
},
|
||||||
lawnchair: {
|
lawnchair: {
|
||||||
exports: 'Lawnchair'
|
exports: 'Lawnchair'
|
||||||
},
|
},
|
||||||
|
@ -14,9 +14,10 @@ $line-height-base: 20 / 16;
|
|||||||
// Colors
|
// Colors
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
$color-blue: #00c6ff;
|
|
||||||
$color-black: #000;
|
$color-black: #000;
|
||||||
$color-white: #fff;
|
$color-white: #fff;
|
||||||
|
$color-blue: #00c6ff;
|
||||||
|
$color-red: #ff878d;
|
||||||
$color-grey: #666;
|
$color-grey: #666;
|
||||||
$color-grey-input: #949494;
|
$color-grey-input: #949494;
|
||||||
$color-grey-dark: #333;
|
$color-grey-dark: #333;
|
||||||
@ -73,7 +74,7 @@ $label-font-size: $font-size-small;
|
|||||||
$label-padding-horizontal: 0.8em;
|
$label-padding-horizontal: 0.8em;
|
||||||
$label-padding-vertical: 0.3em;
|
$label-padding-vertical: 0.3em;
|
||||||
|
|
||||||
$label-primary-back-color: #ff878d;
|
$label-primary-back-color: $color-red;
|
||||||
$label-primary-color: #fff;
|
$label-primary-color: #fff;
|
||||||
|
|
||||||
$label-light-back-color: #fff;
|
$label-light-back-color: #fff;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
@import "components/mail-addresses";
|
@import "components/mail-addresses";
|
||||||
@import "components/spinner";
|
@import "components/spinner";
|
||||||
@import "components/scrollbars";
|
@import "components/scrollbars";
|
||||||
|
@import "components/tags-input";
|
||||||
|
|
||||||
// Views
|
// Views
|
||||||
@import "views/shared";
|
@import "views/shared";
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
.mail-addresses {
|
.mail-addresses {
|
||||||
p {
|
p {
|
||||||
margin: 0.4em 0 0.2em;
|
margin: 0.4em 0 0.2em;
|
||||||
cursor: text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
|
87
src/sass/components/_tags-input.scss
Normal file
87
src/sass/components/_tags-input.scss
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// Styling for ngTagsInput
|
||||||
|
.tags-input {
|
||||||
|
|
||||||
|
.host {
|
||||||
|
position: relative;
|
||||||
|
&:active {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
overflow: hidden;
|
||||||
|
word-wrap: break-word;
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
.tag-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.tag-item {
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
.remove-button {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
vertical-align: middle;
|
||||||
|
line-height: 0.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tags .input {
|
||||||
|
border: 0;
|
||||||
|
outline: none;
|
||||||
|
margin: 2px;
|
||||||
|
padding: 0;
|
||||||
|
padding-left: 5px;
|
||||||
|
float: left;
|
||||||
|
min-width: 10em;
|
||||||
|
|
||||||
|
&.invalid-tag {
|
||||||
|
color: $color-red;
|
||||||
|
}
|
||||||
|
&::-ms-clear {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li.ng-animate {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete {
|
||||||
|
margin-top: 5px;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 999;
|
||||||
|
width: 100%;
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid $color-grey-lighter;
|
||||||
|
box-shadow: 2px 2px 5px rgba($color-black, 0.2);
|
||||||
|
|
||||||
|
.suggestion-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
.suggestion-item {
|
||||||
|
padding: 5px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: $color-black;
|
||||||
|
background-color: $color-white;
|
||||||
|
|
||||||
|
em {
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
&.selected {
|
||||||
|
color: white;
|
||||||
|
background-color: $color-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,27 +20,44 @@
|
|||||||
.mail-addresses {
|
.mail-addresses {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
|
||||||
|
|
||||||
.mail-addresses-more {
|
p {
|
||||||
float: right;
|
position: relative;
|
||||||
margin: 0.4em 0;
|
padding-left: 3em;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
.mail-addresses-more {
|
||||||
display: inline-block;
|
position: relative;
|
||||||
background: none;
|
float: right;
|
||||||
padding: 0 0.5em;
|
margin: 0.4em 0;
|
||||||
margin: 0;
|
z-index: 1;
|
||||||
text-decoration: none;
|
|
||||||
color: $color-black;
|
|
||||||
transition: color 0.3s;
|
|
||||||
border: 0;
|
|
||||||
outline: 0;
|
|
||||||
|
|
||||||
&:hover,
|
button {
|
||||||
&:focus {
|
display: inline-block;
|
||||||
color: $color-blue;
|
background: none;
|
||||||
text-decoration: underline;
|
padding: 0 0.5em;
|
||||||
|
margin: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
color: $color-black;
|
||||||
|
transition: color 0.3s;
|
||||||
|
border: 0;
|
||||||
|
outline: 0;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
color: $color-blue;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.ng-animate {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,23 +10,37 @@
|
|||||||
<button wo-touch="showCC = true;" ng-hide="showCC">Cc</button>
|
<button wo-touch="showCC = true;" ng-hide="showCC">Cc</button>
|
||||||
<button wo-touch="showBCC = true;" ng-hide="showBCC">Bcc</button>
|
<button wo-touch="showBCC = true;" ng-hide="showBCC">Bcc</button>
|
||||||
</div>
|
</div>
|
||||||
<p field="to">
|
<p focus-input="state.lightbox === 'write' && writerTitle !== 'Reply'"
|
||||||
|
focus-input-on-click>
|
||||||
<label>To:</label>
|
<label>To:</label>
|
||||||
<span ng-repeat="recipient in to track by $index">
|
<tags-input class="tags-input" ng-model="to" type="email" tabindex="1" add-on-space="true" add-on-enter="true" enable-editing-last-tag="true"
|
||||||
<input type="email" id="to{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(to, $index)" address-input="to" tabindex="1" ng-mouseover="getKeyId(recipient)" focus-me="$index === 0 && state.lightbox === 'write' && writerTitle !== 'Reply'">
|
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)" on-tag-removed="checkSendStatus()"
|
||||||
</span>
|
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||||
|
placeholder="add recipient">
|
||||||
|
<auto-complete source="lookupAddressBook($query)" min-length="1"></auto-complete>
|
||||||
|
</tags-input>
|
||||||
</p>
|
</p>
|
||||||
<p field="cc" ng-show="showCC === true">
|
<p ng-show="showCC === true"
|
||||||
|
focus-input="state.lightbox === 'write' && writerTitle !== 'Reply'"
|
||||||
|
focus-input-on-click>
|
||||||
<label>Cc:</label>
|
<label>Cc:</label>
|
||||||
<span ng-repeat="recipient in cc track by $index">
|
<tags-input class="tags-input" ng-model="cc" type="email" tabindex="1" add-on-space="true" add-on-enter="true" enable-editing-last-tag="true"
|
||||||
<input type="email" id="cc{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(cc, $index)" address-input="cc" tabindex="1" ng-mouseover="getKeyId(recipient)">
|
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)" on-tag-removed="checkSendStatus()"
|
||||||
</span>
|
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||||
|
placeholder="add cc">
|
||||||
|
<auto-complete source="lookupAddressBook($query)" min-length="1"></auto-complete>
|
||||||
|
</tags-input>
|
||||||
</p>
|
</p>
|
||||||
<p field="bcc" ng-show="showBCC === true">
|
<p ng-show="showBCC === true"
|
||||||
|
focus-input="state.lightbox === 'write' && writerTitle !== 'Reply'"
|
||||||
|
focus-input-on-click>
|
||||||
<label>Bcc:</label>
|
<label>Bcc:</label>
|
||||||
<span ng-repeat="recipient in bcc track by $index">
|
<tags-input class="tags-input" ng-model="bcc" type="email" tabindex="1" add-on-space="true" add-on-enter="true" enable-editing-last-tag="true"
|
||||||
<input type="email" id="bcc{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(bcc, $index)" address-input="bcc" tabindex="1" ng-mouseover="getKeyId(recipient)">
|
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)" on-tag-removed="checkSendStatus()"
|
||||||
</span>
|
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||||
|
placeholder="add bcc">
|
||||||
|
<auto-complete source="lookupAddressBook($query)" min-length="1"></auto-complete>
|
||||||
|
</tags-input>
|
||||||
</p>
|
</p>
|
||||||
</div><!--/.mail-addresses-->
|
</div><!--/.mail-addresses-->
|
||||||
|
|
||||||
|
@ -63,10 +63,11 @@ define(function(require) {
|
|||||||
expect(scope.state.writer.write).to.exist;
|
expect(scope.state.writer.write).to.exist;
|
||||||
expect(scope.state.writer.close).to.exist;
|
expect(scope.state.writer.close).to.exist;
|
||||||
expect(scope.verify).to.exist;
|
expect(scope.verify).to.exist;
|
||||||
expect(scope.onAddressUpdate).to.exist;
|
|
||||||
expect(scope.checkSendStatus).to.exist;
|
expect(scope.checkSendStatus).to.exist;
|
||||||
expect(scope.updatePreview).to.exist;
|
expect(scope.updatePreview).to.exist;
|
||||||
expect(scope.sendToOutbox).to.exist;
|
expect(scope.sendToOutbox).to.exist;
|
||||||
|
expect(scope.tagStyle).to.exist;
|
||||||
|
expect(scope.lookupAddressBook).to.exist;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,9 +88,7 @@ define(function(require) {
|
|||||||
scope.state.writer.write();
|
scope.state.writer.write();
|
||||||
|
|
||||||
expect(scope.writerTitle).to.equal('New email');
|
expect(scope.writerTitle).to.equal('New email');
|
||||||
expect(scope.to).to.deep.equal([{
|
expect(scope.to).to.deep.equal([]);
|
||||||
address: ''
|
|
||||||
}]);
|
|
||||||
expect(scope.subject).to.equal('');
|
expect(scope.subject).to.equal('');
|
||||||
expect(scope.body).to.equal('');
|
expect(scope.body).to.equal('');
|
||||||
expect(scope.ciphertextPreview).to.equal(undefined);
|
expect(scope.ciphertextPreview).to.equal(undefined);
|
||||||
@ -121,8 +120,6 @@ define(function(require) {
|
|||||||
expect(scope.writerTitle).to.equal('Reply');
|
expect(scope.writerTitle).to.equal('Reply');
|
||||||
expect(scope.to).to.deep.equal([{
|
expect(scope.to).to.deep.equal([{
|
||||||
address: address,
|
address: address,
|
||||||
}, {
|
|
||||||
address: ''
|
|
||||||
}]);
|
}]);
|
||||||
expect(scope.subject).to.equal('Re: ' + subject);
|
expect(scope.subject).to.equal('Re: ' + subject);
|
||||||
expect(scope.body).to.contain(body);
|
expect(scope.body).to.contain(body);
|
||||||
@ -156,9 +153,7 @@ define(function(require) {
|
|||||||
scope.state.writer.write(re, null, true);
|
scope.state.writer.write(re, null, true);
|
||||||
|
|
||||||
expect(scope.writerTitle).to.equal('Forward');
|
expect(scope.writerTitle).to.equal('Forward');
|
||||||
expect(scope.to).to.deep.equal([{
|
expect(scope.to).to.deep.equal([]);
|
||||||
address: ''
|
|
||||||
}]);
|
|
||||||
expect(scope.subject).to.equal('Fwd: ' + subject);
|
expect(scope.subject).to.equal('Fwd: ' + subject);
|
||||||
expect(scope.body).to.contain(body);
|
expect(scope.body).to.contain(body);
|
||||||
expect(scope.ciphertextPreview).to.be.undefined;
|
expect(scope.ciphertextPreview).to.be.undefined;
|
||||||
@ -171,29 +166,6 @@ define(function(require) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('onAddressUpdate', function() {
|
|
||||||
var verifyMock;
|
|
||||||
|
|
||||||
beforeEach(function() {
|
|
||||||
verifyMock = sinon.stub(scope, 'verify');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function() {
|
|
||||||
scope.verify.restore();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should do nothing for normal address', function() {
|
|
||||||
var to = [{
|
|
||||||
address: 'asdf@asdf.de'
|
|
||||||
}];
|
|
||||||
scope.onAddressUpdate(to, 0);
|
|
||||||
|
|
||||||
expect(to.length).to.equal(1);
|
|
||||||
expect(to[0].address).to.equal('asdf@asdf.de');
|
|
||||||
expect(verifyMock.calledOnce).to.be.true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('verify', function() {
|
describe('verify', function() {
|
||||||
var checkSendStatusMock;
|
var checkSendStatusMock;
|
||||||
|
|
||||||
@ -205,6 +177,10 @@ define(function(require) {
|
|||||||
scope.checkSendStatus.restore();
|
scope.checkSendStatus.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should do nothing if recipient is not provided', function() {
|
||||||
|
scope.verify(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not work for invalid email addresses', function() {
|
it('should not work for invalid email addresses', function() {
|
||||||
var recipient = {
|
var recipient = {
|
||||||
address: ''
|
address: ''
|
||||||
@ -387,5 +363,43 @@ define(function(require) {
|
|||||||
expect(scope.replyTo.answered).to.be.true;
|
expect(scope.replyTo.answered).to.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('lookupAddressBook', function() {
|
||||||
|
it('should work', function(done) {
|
||||||
|
keychainMock.listLocalPublicKeys.yields(null, [{
|
||||||
|
userId: 'test@asdf.com',
|
||||||
|
publicKey: 'KEY'
|
||||||
|
}]);
|
||||||
|
|
||||||
|
var result = scope.lookupAddressBook('test');
|
||||||
|
|
||||||
|
result.then(function(response) {
|
||||||
|
expect(response).to.deep.equal([{
|
||||||
|
address: 'test@asdf.com'
|
||||||
|
}]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
scope.$digest();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should work with cache', function(done) {
|
||||||
|
scope.addressBookCache = [{
|
||||||
|
address: 'test@asdf.com'
|
||||||
|
}, {
|
||||||
|
address: 'tes@asdf.com'
|
||||||
|
}];
|
||||||
|
|
||||||
|
var result = scope.lookupAddressBook('test');
|
||||||
|
|
||||||
|
result.then(function(response) {
|
||||||
|
expect(response).to.deep.equal([{
|
||||||
|
address: 'test@asdf.com'
|
||||||
|
}]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
scope.$digest();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user