| 66 | } |
| 67 | |
| 68 | static async sendNotification(message: string, ...args: any[]) { |
| 69 | const targets = await user.getMulti({ priv: { $bitsAllSet: PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION } }) |
| 70 | .project({ _id: 1, viewLang: 1 }).toArray(); |
| 71 | return Promise.all(targets.map(({ _id, viewLang }) => { |
| 72 | const msg = app.i18n.translate(message, [viewLang || system.get('server.language')]).format(...args); |
| 73 | return MessageModel.send(1, _id, msg, MessageModel.FLAG_RICHTEXT); |
| 74 | })); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | export async function apply() { |