Skip to content

fix: regular expressions in word mutes

What

  • Handle SyntaxExceptions from faulty RegExps in word mutes.
  • Prevent such exceptions from occurring in the first place by
    • checking that regular expressions in word mutes have valid syntax in the frontend and
    • checking that regular expressions in hard word mutes have valid syntax in the backend (endpoint api/i/update).
  • Clean up empty lines etc. when setting word mutes instead of when checking each note. This should improve perfomance.
  • Correctly handle regular expressions containing spaces: Before they would be split at spaces like other lines, causing them not to be recognized.

Why

Handling exceptions fixes #8245 (closed). Preventing such exceptions improves the user experience.

Additional info

The storage format of muted words will be changed to Array<string | string[]>, where an array element of type string represents a regular expression, and string[] represents a normal word mute.

Hard word mutes can be migrated, but soft word mutes may stop working correctly if they contain RegExps or empty lines. This can be fixed by going to soft word mute settings and saving once. This will update the structure to the new format.

To do

  • Fix behaviour of frontend.
  • Fix behaviour of backend
    • migration for hard word mutes.
  • New i18n strings need to be added. English version below, Japanese version welcome. 🙏
regexpError: "Regular Expression error"
regexpErrorDescription: "Error in the regular expression on line {line} in your {tab} word mutes:"

Merge request reports

Loading