mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 00:58:26 +01:00
[MIRROR] The word filter will now be less scared of double or trailing spaces [MDB IGNORE] (#9375)
* The word filter will now be less scared of double or trailing spaces (#62703) It kept on tripping because the RegEx expression was malformed due to an absence of words in to_join_on_whitespace_splits, which caused it to filter out spaces that were at the beginning or at the end of a message, or if there was two spaces one by the other. Also prevents people from sending a message that's only spaces in OOC, because that's a little silly. * The word filter will now be less scared of double or trailing spaces Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
co-authored by
GoldenAlpharex
parent
adff589744
commit
9750cca7cb
@@ -28,7 +28,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
|
||||
if(QDELETED(src))
|
||||
return
|
||||
|
||||
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
|
||||
msg = trim(copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN))
|
||||
var/raw_msg = msg
|
||||
|
||||
var/list/filter_result = is_ooc_filtered(msg)
|
||||
|
||||
@@ -50,6 +50,14 @@
|
||||
BLOCKED_SHARED,
|
||||
)
|
||||
|
||||
test_filter(
|
||||
" This message has a space at the beginning, a double space, and a space at the end, but it's fine! ",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
)
|
||||
|
||||
/datum/unit_test/chat_filter_sanity/proc/test_filter(
|
||||
message,
|
||||
blocked_word,
|
||||
|
||||
Reference in New Issue
Block a user