discourse/app/jobs
Krzysztof Kotlarek e82e255531
FIX: serialize Flags instead of PostActionType (#28362)
### 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-14 12:13:46 +10:00
..
concerns DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
onceoff FIX: Fix Jobs::Onceoff.enqueue_all undefined method for nilClass error (#28073) 2024-07-25 15:52:42 +08:00
regular FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
scheduled FIX: Ensure JsLocaleHelper to not output deprecated translations (#28037) 2024-07-29 15:21:25 +08:00
base.rb FEATURE: Add live_slots_(start|finish) for Sidekiq perf logging (#28260) 2024-08-07 15:48:24 +08:00