@meith/messages 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/service.ts +1 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meith/messages",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@meith/core": "0.
|
|
23
|
-
"@meith/
|
|
24
|
-
"@meith/
|
|
22
|
+
"@meith/core": "0.22.0",
|
|
23
|
+
"@meith/markdown": "0.22.0",
|
|
24
|
+
"@meith/i18n": "0.22.0"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/service.ts
CHANGED
|
@@ -47,10 +47,6 @@ export interface Draft {
|
|
|
47
47
|
readonly replyToId: number | null
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* Where a plugin sees a private message. `before` may rewrite it or return null
|
|
52
|
-
* to drop it; `sent` is told what was stored.
|
|
53
|
-
*/
|
|
54
50
|
export interface MessageAudit {
|
|
55
51
|
readonly before: (input: {
|
|
56
52
|
readonly senderId: number
|
|
@@ -74,11 +70,6 @@ export const NO_MESSAGE_AUDIT: MessageAudit = {
|
|
|
74
70
|
sent: async () => {},
|
|
75
71
|
}
|
|
76
72
|
|
|
77
|
-
/**
|
|
78
|
-
* What `send` answers when a plugin suppressed the message. The sender is not
|
|
79
|
-
* told, which is the point: a spam filter that announces itself is a spam
|
|
80
|
-
* filter somebody tunes against.
|
|
81
|
-
*/
|
|
82
73
|
export const SUPPRESSED = 0
|
|
83
74
|
|
|
84
75
|
export class MessageService {
|
|
@@ -200,11 +191,6 @@ export class MessageService {
|
|
|
200
191
|
})
|
|
201
192
|
if (proposed === null) return SUPPRESSED
|
|
202
193
|
|
|
203
|
-
/*
|
|
204
|
-
* Only the recipients the board already resolved survive: a plugin may
|
|
205
|
-
* take one off the list, and cannot put one on it, because the addressees
|
|
206
|
-
* are the sender's choice and the board's check, not a plugin's.
|
|
207
|
-
*/
|
|
208
194
|
const kept = new Set(proposed.recipientIds)
|
|
209
195
|
const recipients = resolved.filter((recipient) => kept.has(recipient.userId as number))
|
|
210
196
|
if (recipients.length === 0) return SUPPRESSED
|
|
@@ -394,9 +380,7 @@ export class MessageService {
|
|
|
394
380
|
private async notify(run: () => Promise<void> | undefined): Promise<void> {
|
|
395
381
|
try {
|
|
396
382
|
await run()
|
|
397
|
-
} catch {
|
|
398
|
-
/* ignore */
|
|
399
|
-
}
|
|
383
|
+
} catch {}
|
|
400
384
|
}
|
|
401
385
|
}
|
|
402
386
|
|