1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-22 15:28:49 -05:00

[WO-390] include attachments in forwarded message

This commit is contained in:
Felix Hammerl 2014-05-14 17:29:27 +02:00
parent bb84da4324
commit 48b394f3bd
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() {