Added createdAtVersion property to newly created notifications

refs https://linear.app/tryghost/issue/CORE-64/resolve-undissmissable-update-notification-banners

- The property is meant to track Ghost instance version the notification was received and processed at.
- This information should be useful in the future to dismiss outdated notifications
This commit is contained in:
Naz 2021-10-07 18:25:57 +02:00 committed by naz
parent 53ae852a0e
commit 8737ec8888
5 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ module.exports = {
delete notification.seen; delete notification.seen;
delete notification.seenBy; delete notification.seenBy;
delete notification.addedAt; delete notification.addedAt;
delete notification.createdAtVersion;
}); });
frame.response = { frame.response = {

View File

@ -19,6 +19,7 @@ module.exports = {
delete notification.seen; delete notification.seen;
delete notification.seenBy; delete notification.seenBy;
delete notification.addedAt; delete notification.addedAt;
delete notification.createdAtVersion;
}); });
frame.response = { frame.response = {

View File

@ -19,6 +19,7 @@ module.exports = {
delete notification.seen; delete notification.seen;
delete notification.seenBy; delete notification.seenBy;
delete notification.addedAt; delete notification.addedAt;
delete notification.createdAtVersion;
}); });
frame.response = { frame.response = {

View File

@ -123,7 +123,8 @@ class Notifications {
dismissible: true, dismissible: true,
location: 'bottom', location: 'bottom',
status: 'alert', status: 'alert',
id: ObjectId().toHexString() id: ObjectId().toHexString(),
createdAtVersion: this.ghostVersion.full
}; };
const overrides = { const overrides = {

View File

@ -194,6 +194,7 @@ describe('Notifications Service', function () {
createdNotification.dismissible.should.be.false(); createdNotification.dismissible.should.be.false();
createdNotification.top.should.be.true(); createdNotification.top.should.be.true();
createdNotification.message.should.equal('Hello test world!'); createdNotification.message.should.equal('Hello test world!');
createdNotification.createdAtVersion.should.equal('4.1.0');
}); });
}); });