Skip to content
Snippets Groups Projects
Unverified Commit 35e7dca2 authored by syuilo's avatar syuilo Committed by GitHub
Browse files

Resolve #3847 (#3849)

* Update notifications.ts

* Update notifications.ts

* Update notifications.ts

* Update notifications.ts

* Add missing semicolon

* Improve readability

* Fix typo
parent 6c4ea5e0
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment