summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/AntennaService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-02-28 20:20:23 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-02-28 20:20:23 +0900
commit83a67606a9a8f7077dc3814c23b3fb6485017785 (patch)
tree7644c4eaa14bf49184c8658a021fbb49064e2cc1 /packages/backend/src/core/AntennaService.ts
parentenhance(client): emojisはIndexedDBに保存する (#10121) (diff)
downloadsharkey-83a67606a9a8f7077dc3814c23b3fb6485017785.tar.gz
sharkey-83a67606a9a8f7077dc3814c23b3fb6485017785.tar.bz2
sharkey-83a67606a9a8f7077dc3814c23b3fb6485017785.zip
enhance(server): make antenna handle cw
Resolve #10140
Diffstat (limited to 'packages/backend/src/core/AntennaService.ts')
-rw-r--r--packages/backend/src/core/AntennaService.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts
index 0e72545934..05930350fa 100644
--- a/packages/backend/src/core/AntennaService.ts
+++ b/packages/backend/src/core/AntennaService.ts
@@ -171,13 +171,15 @@ export class AntennaService implements OnApplicationShutdown {
.filter(xs => xs.length > 0);
if (keywords.length > 0) {
- if (note.text == null) return false;
+ if (note.text == null && note.cw == null) return false;
+
+ const _text = (note.text ?? '') + '\n' + (note.cw ?? '');
const matched = keywords.some(and =>
and.every(keyword =>
antenna.caseSensitive
- ? note.text!.includes(keyword)
- : note.text!.toLowerCase().includes(keyword.toLowerCase()),
+ ? _text.includes(keyword)
+ : _text.toLowerCase().includes(keyword.toLowerCase()),
));
if (!matched) return false;
@@ -189,13 +191,15 @@ export class AntennaService implements OnApplicationShutdown {
.filter(xs => xs.length > 0);
if (excludeKeywords.length > 0) {
- if (note.text == null) return false;
-
+ if (note.text == null && note.cw == null) return false;
+
+ const _text = (note.text ?? '') + '\n' + (note.cw ?? '');
+
const matched = excludeKeywords.some(and =>
and.every(keyword =>
antenna.caseSensitive
- ? note.text!.includes(keyword)
- : note.text!.toLowerCase().includes(keyword.toLowerCase()),
+ ? _text.includes(keyword)
+ : _text.toLowerCase().includes(keyword.toLowerCase()),
));
if (matched) return false;