| 212 | }); |
| 213 | |
| 214 | function isMentionsTimelineQuery(data: any): boolean { |
| 215 | if (data.types && Array.isArray(data.types)) { |
| 216 | // for Ivory |
| 217 | if ((data.types.length === 1 && data.types[0] === 'mention') || |
| 218 | (data.types.length === 2 && data.types[0] === 'mention' && data.types[1] === 'mention')) |
| 219 | return true; |
| 220 | } else if (data.exclude_types && Array.isArray(data.exclude_types)) { |
| 221 | // for Pinafore |
| 222 | const check = [ |
| 223 | 'follow', 'favourite', 'reblog', 'poll', |
| 224 | 'admin.sign_up', 'update', 'follow_request', 'admin.report' |
| 225 | ]; |
| 226 | if (data.exclude_types.length === check.length) { |
| 227 | for (let i = 0; i < check.length; i++) { |
| 228 | if (check[i] !== data.exclude_types[i]) |
| 229 | return false; |
| 230 | } |
| 231 | return true; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | return false; |
| 236 | } |
| 237 | |
| 238 | app.get('/api/v1/notifications', async (req, res) => { |
| 239 | const params: Record<string, any> = buildParams(true); |