mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Added default stats object to email model
- The serialized object is meant to serve as a placeholder for future email related stats pooled from mail service provider
This commit is contained in:
parent
0a17f5d3c0
commit
93b22af899
3 changed files with 18 additions and 2 deletions
|
@ -7,7 +7,15 @@ const Email = ghostBookshelf.Model.extend({
|
|||
defaults: function defaults() {
|
||||
return {
|
||||
uuid: uuid.v4(),
|
||||
status: 'pending'
|
||||
status: 'pending',
|
||||
stats: JSON.stringify({
|
||||
delivered: 0,
|
||||
failed: 0,
|
||||
opened: 0,
|
||||
clicked: 0,
|
||||
unsubscribed: 0,
|
||||
complaints: 0
|
||||
})
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -33,6 +33,15 @@ describe('Email API', function () {
|
|||
should.exist(jsonResponse.emails);
|
||||
jsonResponse.emails.should.have.length(1);
|
||||
localUtils.API.checkResponse(jsonResponse.emails[0], 'email');
|
||||
|
||||
const stats = JSON.parse(jsonResponse.emails[0].stats);
|
||||
|
||||
should.exist(stats.delivered);
|
||||
should.exist(stats.failed);
|
||||
should.exist(stats.opened);
|
||||
should.exist(stats.clicked);
|
||||
should.exist(stats.unsubscribed);
|
||||
should.exist(stats.complaints);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -425,7 +425,6 @@ DataGenerator.Content = {
|
|||
id: ObjectId.generate(),
|
||||
uuid: '6b6afda6-4b5e-4893-bff6-f16859e8349a',
|
||||
status: 'submitted',
|
||||
stats: '',
|
||||
email_count: 2,
|
||||
subject: 'You got mailed!',
|
||||
html: '<p>Look! I\'m an email</p>',
|
||||
|
|
Loading…
Add table
Reference in a new issue