summaryrefslogtreecommitdiff
path: root/src/api/endpoints/notifications
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-04 04:28:38 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-04 04:28:38 +0900
commit3c1b92baa1ac15c23fe63e2f50739105252ca516 (patch)
tree35a0ae58802891f05209c83e780440775075e088 /src/api/endpoints/notifications
parentMerge pull request #233 from syuilo/greenkeeper/inquirer-3.0.6 (diff)
downloadmisskey-3c1b92baa1ac15c23fe63e2f50739105252ca516.tar.gz
misskey-3c1b92baa1ac15c23fe63e2f50739105252ca516.tar.bz2
misskey-3c1b92baa1ac15c23fe63e2f50739105252ca516.zip
Follow linter
Diffstat (limited to 'src/api/endpoints/notifications')
-rw-r--r--src/api/endpoints/notifications/mark_as_read.ts55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/api/endpoints/notifications/mark_as_read.ts b/src/api/endpoints/notifications/mark_as_read.ts
index 6e75927cfa..703562fecd 100644
--- a/src/api/endpoints/notifications/mark_as_read.ts
+++ b/src/api/endpoints/notifications/mark_as_read.ts
@@ -1,5 +1,3 @@
-'use strict';
-
/**
* Module dependencies
*/
@@ -15,36 +13,35 @@ import event from '../../event';
* @param {any} user
* @return {Promise<any>}
*/
-module.exports = (params, user) =>
- new Promise(async (res, rej) => {
- const [notificationId, notificationIdErr] = it(params.notification_id).expect.id().required().qed();
- if (notificationIdErr) return rej('invalid notification_id param');
+module.exports = (params, user) => new Promise(async (res, rej) => {
+ const [notificationId, notificationIdErr] = it(params.notification_id).expect.id().required().qed();
+ if (notificationIdErr) return rej('invalid notification_id param');
- // Get notification
- const notification = await Notification
- .findOne({
- _id: notificationId,
- i: user._id
- });
+ // Get notification
+ const notification = await Notification
+ .findOne({
+ _id: notificationId,
+ i: user._id
+ });
- if (notification === null) {
- return rej('notification-not-found');
- }
+ if (notification === null) {
+ return rej('notification-not-found');
+ }
- // Update
- notification.is_read = true;
- Notification.update({ _id: notification._id }, {
- $set: {
- is_read: true
- }
- });
+ // Update
+ notification.is_read = true;
+ Notification.update({ _id: notification._id }, {
+ $set: {
+ is_read: true
+ }
+ });
- // Response
- res();
+ // Response
+ res();
- // Serialize
- const notificationObj = await serialize(notification);
+ // Serialize
+ const notificationObj = await serialize(notification);
- // Publish read_notification event
- event(user._id, 'read_notification', notificationObj);
- });
+ // Publish read_notification event
+ event(user._id, 'read_notification', notificationObj);
+});