mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix lint
This commit is contained in:
@@ -181,7 +181,7 @@ describe('User Model', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context.only('notifications', () => {
|
context('notifications', () => {
|
||||||
it('can add notifications without data', () => {
|
it('can add notifications without data', () => {
|
||||||
const user = new User();
|
const user = new User();
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
model as User,
|
model as User,
|
||||||
} from '../../models/user';
|
} from '../../models/user';
|
||||||
import {
|
|
||||||
model as UserNotification,
|
|
||||||
} from '../../models/userNotification';
|
|
||||||
|
|
||||||
const api = {};
|
const api = {};
|
||||||
|
|
||||||
@@ -49,7 +46,7 @@ api.readNotification = {
|
|||||||
$pull: { notifications: { id: req.params.notificationId } },
|
$pull: { notifications: { id: req.params.notificationId } },
|
||||||
}).exec();
|
}).exec();
|
||||||
|
|
||||||
res.respond(200, UserNotification.convertNotificationsToSafeJson(user.notifications));
|
res.respond(200, user.notifications);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,7 +89,7 @@ api.readNotifications = {
|
|||||||
// See https://github.com/HabitRPG/habitica/pull/9321#issuecomment-354187666 for more info
|
// See https://github.com/HabitRPG/habitica/pull/9321#issuecomment-354187666 for more info
|
||||||
user._v += 1;
|
user._v += 1;
|
||||||
|
|
||||||
res.respond(200, UserNotification.convertNotificationsToSafeJson(user.notifications));
|
res.respond(200, user.notifications);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -181,7 +178,7 @@ api.seeNotifications = {
|
|||||||
|
|
||||||
await user.save();
|
await user.save();
|
||||||
|
|
||||||
res.respond(200, UserNotification.convertNotificationsToSafeJson(user.notifications));
|
res.respond(200, user.notifications);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import packageInfo from '../../../package.json';
|
import packageInfo from '../../../package.json';
|
||||||
import {
|
|
||||||
model as UserNotification,
|
|
||||||
} from '../models/userNotification';
|
|
||||||
|
|
||||||
export default function responseHandler (req, res, next) {
|
export default function responseHandler (req, res, next) {
|
||||||
// Only used for successful responses
|
// Only used for successful responses
|
||||||
@@ -16,7 +13,7 @@ export default function responseHandler (req, res, next) {
|
|||||||
if (message) response.message = message;
|
if (message) response.message = message;
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
response.notifications = UserNotification.convertNotificationsToSafeJson(user.notifications);
|
response.notifications = user.notifications;
|
||||||
response.userV = user._v;
|
response.userV = user._v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user