* 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: {
|
markAsRead: {
|
||||||
validator: $.bool.optional,
|
validator: $.bool.optional,
|
||||||
default: true
|
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
|
const notifications = await Notification
|
||||||
.find(query, {
|
.find(query, {
|
||||||
limit: ps.limit,
|
limit: ps.limit,
|
||||||
|
|
Loading…
Reference in a new issue