feat: search cw comments and image alt texts in antennas (close #24)
This commit is contained in:
parent
86cdcc1bdf
commit
e04c6e7b85
2 changed files with 9 additions and 2 deletions
packages/backend/src/misc
|
@ -95,14 +95,19 @@ export async function checkHitAntenna(
|
|||
.map((xs) => xs.filter((x) => x !== ""))
|
||||
.filter((xs) => xs.length > 0);
|
||||
|
||||
let text = `${note.text ?? ""} ${note.cw ?? ""}`;
|
||||
if (note.files != null)
|
||||
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
|
||||
text = text.trim();
|
||||
|
||||
if (keywords.length > 0) {
|
||||
if (note.text == null) return false;
|
||||
|
||||
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()),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue