summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-01-08 13:32:28 +0900
committerGitHub <noreply@github.com>2019-01-08 13:32:28 +0900
commit35e7dca2bb96d26dab4eaf1d9fdd029faa6a2cb0 (patch)
tree24a5632c5b42de35ae48cf369b5b27ae6e91c6fc
parentMerge pull request #3842 from syuilo/l10n_develop (diff)
downloadsharkey-35e7dca2bb96d26dab4eaf1d9fdd029faa6a2cb0.tar.gz
sharkey-35e7dca2bb96d26dab4eaf1d9fdd029faa6a2cb0.tar.bz2
sharkey-35e7dca2bb96d26dab4eaf1d9fdd029faa6a2cb0.zip
Resolve #3847 (#3849)
* Update notifications.ts * Update notifications.ts * Update notifications.ts * Update notifications.ts * Add missing semicolon * Improve readability * Fix typo
-rw-r--r--src/server/api/endpoints/i/notifications.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts
index b1ddd40d13..028d67a018 100644
--- a/src/server/api/endpoints/i/notifications.ts
+++ b/src/server/api/endpoints/i/notifications.ts
@@ -40,6 +40,16 @@ export const meta = {
markAsRead: {
validator: $.bool.optional,
default: true
+ },
+
+ includeTypes: {
+ validator: $.arr($.str.or(['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'poll_vote', 'receiveFollowRequest'])).optional,
+ default: [] as string[]
+ },
+
+ excludeTypes: {
+ validator: $.arr($.str.or(['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'poll_vote', 'receiveFollowRequest'])).optional,
+ default: [] as string[]
}
}
};
@@ -89,6 +99,16 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
};
}
+ if (ps.includeTypes.length > 0) {
+ query.type = {
+ $in: ps.includeTypes
+ };
+ } else if (ps.excludeTypes.length > 0) {
+ query.type = {
+ $nin: ps.excludeTypes
+ };
+ }
+
const notifications = await Notification
.find(query, {
limit: ps.limit,