summaryrefslogtreecommitdiff
path: root/src/api/endpoints/notifications/mark_as_read.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-10-30 22:12:10 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-10-30 22:12:10 +0900
commitcaa47cb38cfc3950539c78ca2e70f2c50e815d2c (patch)
treefc1a70e1c1b105ecf8d74ff4d952eff86ded83f6 /src/api/endpoints/notifications/mark_as_read.ts
parenti18n (diff)
downloadmisskey-caa47cb38cfc3950539c78ca2e70f2c50e815d2c.tar.gz
misskey-caa47cb38cfc3950539c78ca2e70f2c50e815d2c.tar.bz2
misskey-caa47cb38cfc3950539c78ca2e70f2c50e815d2c.zip
未読の通知がある場合アイコンを表示するように
Diffstat (limited to 'src/api/endpoints/notifications/mark_as_read.ts')
-rw-r--r--src/api/endpoints/notifications/mark_as_read.ts47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/api/endpoints/notifications/mark_as_read.ts b/src/api/endpoints/notifications/mark_as_read.ts
deleted file mode 100644
index 5cce33e850..0000000000
--- a/src/api/endpoints/notifications/mark_as_read.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Module dependencies
- */
-import $ from 'cafy';
-import Notification from '../../models/notification';
-import serialize from '../../serializers/notification';
-import event from '../../event';
-
-/**
- * Mark as read a notification
- *
- * @param {any} params
- * @param {any} user
- * @return {Promise<any>}
- */
-module.exports = (params, user) => new Promise(async (res, rej) => {
- const [notificationId, notificationIdErr] = $(params.notification_id).id().$;
- if (notificationIdErr) return rej('invalid notification_id param');
-
- // Get notification
- const notification = await Notification
- .findOne({
- _id: notificationId,
- i: user._id
- });
-
- if (notification === null) {
- return rej('notification-not-found');
- }
-
- // Update
- notification.is_read = true;
- Notification.update({ _id: notification._id }, {
- $set: {
- is_read: true
- }
- });
-
- // Response
- res();
-
- // Serialize
- const notificationObj = await serialize(notification);
-
- // Publish read_notification event
- event(user._id, 'read_notification', notificationObj);
-});