mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Notifications: remove timestamps (#8287)
* user notifications: make updatedAt public * notifications: disable timestamps
This commit is contained in:
@@ -98,7 +98,6 @@ describe('response middleware', () => {
|
||||
{
|
||||
type: notification.type,
|
||||
id: notification.id,
|
||||
createdAt: notification.createdAt,
|
||||
data: {},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -55,7 +55,7 @@ describe('User Model', () => {
|
||||
|
||||
let userToJSON = user.toJSON();
|
||||
expect(user.notifications.length).to.equal(1);
|
||||
expect(userToJSON.notifications[0]).to.have.all.keys(['data', 'id', 'type', 'createdAt']);
|
||||
expect(userToJSON.notifications[0]).to.have.all.keys(['data', 'id', 'type']);
|
||||
expect(userToJSON.notifications[0].type).to.equal('CRON');
|
||||
expect(userToJSON.notifications[0].data).to.eql({});
|
||||
});
|
||||
@@ -67,7 +67,7 @@ describe('User Model', () => {
|
||||
|
||||
let userToJSON = user.toJSON();
|
||||
expect(user.notifications.length).to.equal(1);
|
||||
expect(userToJSON.notifications[0]).to.have.all.keys(['data', 'id', 'type', 'createdAt']);
|
||||
expect(userToJSON.notifications[0]).to.have.all.keys(['data', 'id', 'type']);
|
||||
expect(userToJSON.notifications[0].type).to.equal('CRON');
|
||||
expect(userToJSON.notifications[0].data).to.eql({field: 1});
|
||||
});
|
||||
|
||||
@@ -134,7 +134,7 @@ function awardLoginIncentives (user) {
|
||||
// Remove old notifications if they exists
|
||||
user.notifications
|
||||
.toObject()
|
||||
.find((notif, index) => {
|
||||
.forEach((notif, index) => {
|
||||
if (notif.type === 'LOGIN_INCENTIVE') user.notifications.splice(index, 1);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ export let schema = new Schema({
|
||||
|
||||
schema.plugin(baseModel, {
|
||||
noSet: ['_id', 'id'],
|
||||
timestamps: true,
|
||||
private: ['updatedAt'],
|
||||
// timestamps: true, // Temporarily removed to debug a possible bug
|
||||
_id: false, // use id instead of _id
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user