2018-11-11 21:17:51 +09:00
|
|
|
export default function(me, settings, note) {
|
2019-02-28 14:13:18 +09:00
|
|
|
const isMyNote = me && (note.userId == me.id);
|
2018-11-11 21:17:51 +09:00
|
|
|
const isPureRenote = note.renoteId != null && note.text == null && note.fileIds.length == 0 && note.poll == null;
|
|
|
|
|
2018-12-29 05:51:17 +09:00
|
|
|
const includesMutedWords = (text: string) =>
|
|
|
|
text
|
2019-02-16 19:37:05 +09:00
|
|
|
? settings.mutedWords.some(q => q.length > 0 && !q.some(word =>
|
|
|
|
word.startsWith('/') && word.endsWith('/') ? !(new RegExp(word.substr(1, word.length - 2)).test(text)) : !text.includes(word)))
|
2018-12-29 05:51:17 +09:00
|
|
|
: false;
|
|
|
|
|
|
|
|
return (
|
|
|
|
(!isMyNote && note.reply && includesMutedWords(note.reply.text)) ||
|
|
|
|
(!isMyNote && note.renote && includesMutedWords(note.renote.text)) ||
|
2019-05-05 09:27:55 +09:00
|
|
|
(!settings.showMyRenotes && isMyNote && isPureRenote) ||
|
|
|
|
(!settings.showRenotedMyNotes && isPureRenote && note.renote.userId == me.id) ||
|
|
|
|
(!settings.showLocalRenotes && isPureRenote && note.renote.user.host == null) ||
|
2018-12-29 05:51:17 +09:00
|
|
|
(!isMyNote && includesMutedWords(note.text))
|
|
|
|
);
|
2018-11-11 21:17:51 +09:00
|
|
|
}
|