mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 07:03:08 +02:00
* Update notifications.ts * Update notifications.ts * Update notifications.ts * Update notifications.ts * Add missing semicolon * Improve readability * Fix typo
This commit is contained in:
parent
6c4ea5e087
commit
35e7dca2bb
1 changed files with 20 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue