StealEmojiPolicy: fix String rejected_shortcodes
authorHélène <pleroma-dev@helene.moe>
Wed, 18 May 2022 19:25:10 +0000 (21:25 +0200)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Wed, 29 Jun 2022 19:47:45 +0000 (20:47 +0100)
commit8f140deb8f997ca9f6bdecd98812082800c851f6
treefdd03c0207d0f976179607bc1ba13831fac13e1a
parent661d0ba481c49ee3cc0cd43051558de21f0398a9
StealEmojiPolicy: fix String rejected_shortcodes

* rejected_shortcodes is defined as a list of strings in the
  configuration description. As such, database-based configuration was
  led to handle those settings as strings, and not as the actually
  expected type, Regex.
* This caused each message passing through this MRF, if a rejected
  shortcode was set and the emoji did not exist already on the instance,
  to fail federating, as an exception was raised, swiftly caught and
  mostly silenced.
* This commit fixes the issue by introducing new behavior: strings are
  now handled as perfect matches for an emoji shortcode (meaning that if
  the emoji-to-be-pulled's shortcode is in the blacklist, it will be
  rejected), while still supporting Regex types as before.
lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex
test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs