Add modified alt text mute patch
This commit is contained in:
parent
dfd43183e1
commit
0d4bb30be3
2 changed files with 37 additions and 0 deletions
36
patches/pr384-e_mute-on-alt-text.patch
Normal file
36
patches/pr384-e_mute-on-alt-text.patch
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
From 6f48569e599589fa649a1f81cc74a2e85ef84ae7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: sn0w <me@sn0w.cx>
|
||||||
|
Date: Sun, 31 Mar 2024 03:38:51 +0200
|
||||||
|
Subject: [PATCH] Apply wordfilters to attachment alt-texts
|
||||||
|
|
||||||
|
EDITED to apply review suggestions:
|
||||||
|
- short circuit search and immediately return once match found
|
||||||
|
- Array.some() instead of for loop
|
||||||
|
|
||||||
|
---
|
||||||
|
src/services/status_parser/status_parser.js | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/services/status_parser/status_parser.js b/src/services/status_parser/status_parser.js
|
||||||
|
index ed0f6d57..60129660 100644
|
||||||
|
--- a/src/services/status_parser/status_parser.js
|
||||||
|
+++ b/src/services/status_parser/status_parser.js
|
||||||
|
@@ -3,8 +3,14 @@ import { filter } from 'lodash'
|
||||||
|
export const muteWordHits = (status, muteWords) => {
|
||||||
|
const statusText = status.text.toLowerCase()
|
||||||
|
const statusSummary = status.summary.toLowerCase()
|
||||||
|
+
|
||||||
|
const hits = filter(muteWords, (muteWord) => {
|
||||||
|
- return statusText.includes(muteWord.toLowerCase()) || statusSummary.includes(muteWord.toLowerCase())
|
||||||
|
+ muteWord = muteWord.toLowerCase()
|
||||||
|
+
|
||||||
|
+ return
|
||||||
|
+ statusText.includes(muteWord) ||
|
||||||
|
+ statusSummary.includes(muteWord) ||
|
||||||
|
+ status.attachments.some((a) => a.description?.toLowerCase().includes(muteWord))
|
||||||
|
})
|
||||||
|
|
||||||
|
return hits
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
|
@ -10,3 +10,4 @@ pr416_03_more-emoji-suggestions.patch
|
||||||
pr416_04_reset-post-form-on-send.patch
|
pr416_04_reset-post-form-on-send.patch
|
||||||
pr416_05_post-form-default-to-parent-lang.patch
|
pr416_05_post-form-default-to-parent-lang.patch
|
||||||
pr416_06_fix-conversation-collapse-focus.patch
|
pr416_06_fix-conversation-collapse-focus.patch
|
||||||
|
pr384-e_mute-on-alt-text.patch
|
||||||
|
|
Loading…
Reference in a new issue