summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,