apply mutes to image descriptions
ci/woodpecker/push/lint-sw Pipeline failed
Details
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
Details
ci/woodpecker/push/lint-client Pipeline failed
Details
ci/woodpecker/push/lint-backend Pipeline failed
Details
ci/woodpecker/push/test Pipeline failed
Details
ci/woodpecker/push/lint-sw Pipeline failed
Details
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
Details
ci/woodpecker/push/lint-client Pipeline failed
Details
ci/woodpecker/push/lint-backend Pipeline failed
Details
ci/woodpecker/push/test Pipeline failed
Details
Changelog: Added
This commit is contained in:
parent
095802d059
commit
d34f7c7faa
|
@ -13,11 +13,24 @@ type UserLike = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function checkWordMute(note: NoteLike, me: UserLike | null | undefined, mutedWords: Array<string | string[]>): Promise<boolean> {
|
export async function checkWordMute(note: NoteLike, me: UserLike | null | undefined, mutedWords: Array<string | string[]>): Promise<boolean> {
|
||||||
// 自分自身
|
// own posts
|
||||||
if (me && (note.userId === me.id)) return false;
|
if (me && (note.userId === me.id)) return false;
|
||||||
|
|
||||||
if (mutedWords.length > 0) {
|
if (mutedWords.length > 0) {
|
||||||
const text = ((note.cw ?? '') + '\n' + (note.text ?? '')).trim();
|
const text = [
|
||||||
|
note.cw,
|
||||||
|
note.text,
|
||||||
|
...note.files.map(file => file.comment)
|
||||||
|
]
|
||||||
|
.map(x => {
|
||||||
|
if (x == null || x.trim() == '') {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return x.trim();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(x => x != null)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
if (text === '') return false;
|
if (text === '') return false;
|
||||||
const textLower = text.toLowerCase();
|
const textLower = text.toLowerCase();
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
export function checkWordMute(note: Record<string, any>, me: Record<string, any> | null | undefined, mutedWords: Array<string | string[]>): boolean {
|
export function checkWordMute(note: Record<string, any>, me: Record<string, any> | null | undefined, mutedWords: Array<string | string[]>): boolean {
|
||||||
// 自分自身
|
// own posts
|
||||||
if (me && (note.userId === me.id)) return false;
|
if (me && (note.userId === me.id)) return false;
|
||||||
|
|
||||||
if (mutedWords.length > 0) {
|
if (mutedWords.length > 0) {
|
||||||
const text = ((note.cw ?? '') + '\n' + (note.text ?? '')).trim();
|
const text = [
|
||||||
|
note.cw,
|
||||||
|
note.text,
|
||||||
|
...note.files.map(file => file.comment)
|
||||||
|
]
|
||||||
|
.map(x => {
|
||||||
|
if (x == null || x.trim() == '') {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return x.trim();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(x => x != null)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
if (text === '') return false;
|
if (text === '') return false;
|
||||||
const textLower = text.toLowerCase();
|
const textLower = text.toLowerCase();
|
||||||
|
|
Loading…
Reference in New Issue