discourse/spec
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
..
fabricators UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
fixtures FEATURE: Allow oneboxing private GitHub repo URLs and add private indicator to HTML (#27947) 2024-07-19 12:21:45 +10:00
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers DEV: update base url links to respect subfolder installs (#27740) 2024-07-09 12:42:38 +04:00
import_export DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
initializers DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
integration DEV: Enable Rails 7.1 defaults 2024-08-12 10:41:13 +02:00
integrity DEV: Add spec to ensure app works with multiple tagged loggers 2024-08-13 18:10:03 +02:00
jobs FEATURE: add delay to native push notifications (#28314) 2024-08-13 12:12:05 +04:00
lib FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
migrations DEV: Remove invalid content_security_policy_script_src site setting values from DB (#27588) 2024-06-27 22:17:56 +08:00
models FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
multisite FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
requests FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
script/import_scripts DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
serializers FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
services FEATURE: add delay to native push notifications (#28314) 2024-08-13 12:12:05 +04:00
support DEV: adds logo page component (#28276) 2024-08-08 13:52:48 +02:00
system DEV: Convert account activation pages to use Ember (#28206) 2024-08-12 18:02:00 -03:00
tasks DEV: Stop storing theme-transpiler on filesystem in development (#28198) 2024-08-01 17:59:34 +01:00
views FEATURE: Simplify crawler content for non-canonical post URLs (#26324) 2024-03-26 15:18:46 +00:00
rails_helper.rb DEV: Use rspec mocks to properly verify a race condition 2024-08-06 15:57:04 +02:00
regenerate_swagger_docs DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
swagger_helper.rb DEV: Bump rswag-specs from 2.11.0 to 2.13.0 (#24654) 2023-12-07 08:16:47 +08:00