fix(api): hasMutedWord
for facets with multiple features
#2570
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
hasMutedWord
function used in moderation uses the value of the tag in the facets passed as an argument astags
for judging. The current implementation was to “add the 0th of the features to thetags
if a feature corresponding toisTag
is found”.This is incorrect,
features
is an array that can contain multiple elements, and those of type#tag
can be included after the first. The 0th element can be hidden by a tag that is not the target word of the mute, or it can be a completely unrelated type.Actually, it is possible to create such a post (e.g. https://bsky.app/profile/sugyan.pds.shigepon.net/post/3kukmykhshk2l), and an error will occur if a user with
mutedWords
set tries to view it.Fixed it so all
#tag
types infeatures
are subject to the decision, and added a test.