discourse/app
Krzysztof Kotlarek 094052c1ff
FIX: serialize Flags instead of PostActionType (#28259)
### Why?
Before, all flags were static. Therefore, they were stored in class variables and serialized by SiteSerializer. Recently, we added an option for admins to add their own flags or disable existing flags. Therefore, the class variable had to be dropped because it was unsafe for a multisite environment. However, it started causing performance problems. 

### Solution
When a new Flag system is used, instead of using PostActionType, we can serialize Flags and use fragment cache for performance reasons. 

At the same time, we are still supporting deprecated `replace_flags` API call. When it is used, we fall back to the old solution and the admin cannot add custom flags. In a couple of months, we will be able to drop that API function and clean that code properly. However, because it may still be used, redis cache was introduced to improve performance.

To test backward compatibility you can add this code to any plugin
```ruby
  replace_flags do |flag_settings|
    flag_settings.add(
      4,
      :inappropriate,
      topic_type: true,
      notify_type: true,
      auto_action_type: true,
    )
    flag_settings.add(1001, :trolling, topic_type: true, notify_type: true, auto_action_type: true)
  end
```
2024-08-13 11:22:37 +10:00
..
assets DEV: Convert account activation pages to use Ember (#28206) 2024-08-12 18:02:00 -03:00
controllers FIX: serialize Flags instead of PostActionType (#28259) 2024-08-13 11:22:37 +10:00
helpers UX: Use localized time format in embedded comments (#28014) 2024-07-22 18:42:36 +08:00
jobs FIX: serialize Flags instead of PostActionType (#28259) 2024-08-13 11:22:37 +10:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
models FIX: serialize Flags instead of PostActionType (#28259) 2024-08-13 11:22:37 +10:00
serializers FIX: serialize Flags instead of PostActionType (#28259) 2024-08-13 11:22:37 +10:00
services FIX: Don't clear inline problems when loading admin dashboard (#28220) 2024-08-05 11:45:55 +08:00
views DEV: Convert account activation pages to use Ember (#28206) 2024-08-12 18:02:00 -03:00