1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 19:02:20 -05:00

Merge pull request #62 from whiteout-io/dev/WO-390

[WO-390] include attachments in forwarded message
This commit is contained in:
Tankred Hase 2014-05-15 19:48:51 +02:00
commit 811f35c048
2 changed files with 41 additions and 0 deletions

View File

@ -98,6 +98,13 @@ define(function(require) {
$scope.cc.forEach($scope.verify); $scope.cc.forEach($scope.verify);
} }
// fill attachments on forward
if (forward) {
// create a new array, otherwise removing an attachment will also
// remove it from the original in the mail list as a side effect
$scope.attachments = [].concat(re.attachments);
}
// fill subject // fill subject
if (forward) { if (forward) {
$scope.subject = 'Fwd: ' + re.subject; $scope.subject = 'Fwd: ' + re.subject;

View File

@ -124,6 +124,40 @@ define(function(require) {
scope.verify.restore(); scope.verify.restore();
}); });
it('should prefill write view for forward', function() {
var verifyMock = sinon.stub(scope, 'verify'),
address = 'pity@dafool',
subject = 'Ermahgerd!',
body = 'so much body!',
re = {
from: [{
address: address
}],
to: [{
address: address
}],
subject: subject,
sentDate: new Date(),
body: body,
attachments: [{}]
};
scope.state.writer.write(re, null, true);
expect(scope.writerTitle).to.equal('Forward');
expect(scope.to).to.deep.equal([{
address: ''
}]);
expect(scope.subject).to.equal('Fwd: ' + subject);
expect(scope.body).to.contain(body);
expect(scope.ciphertextPreview).to.not.be.empty;
expect(verifyMock.called).to.be.true;
expect(scope.attachments).to.not.equal(re.attachments); // not the same reference
expect(scope.attachments).to.deep.equal(re.attachments); // but the same content
scope.verify.restore();
});
}); });
describe('onAddressUpdate', function() { describe('onAddressUpdate', function() {