discourse/db/fixtures
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
..
001_refresh.rb DEV: Apply syntax_tree formatting to db/* 2023-01-09 11:59:41 +00:00
002_groups.rb DEV: Apply syntax_tree formatting to db/* 2023-01-09 11:59:41 +00:00
003_flags.rb FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
003_post_action_types.rb PERF: do not expire cache when PostActionType is saved (#28337) 2024-08-13 18:01:31 +10:00
004_screened_ip_addresses.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
005_badge_types.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
006_badges.rb UX: Update badge icons (#20462) 2023-02-28 10:42:05 +08:00
007_web_hook_event_types.rb FEATURE: granular webhooks (#23070) 2023-10-09 03:35:31 +00:00
009_users.rb DEV: Use Discourse::SYSTEM_USER_ID in fixtures/009_users (#24743) 2023-12-07 09:04:45 +10:00
010_uploads.rb DEV: update comments on unused Uploads. -4 is now considered reserved. (#14362) 2021-09-16 17:44:51 -04:00
500_categories.rb DEV: Apply syntax_tree formatting to db/* 2023-01-09 11:59:41 +00:00
600_themes.rb DEV: Use Discourse::SYSTEM_USER_ID in fixtures/009_users (#24743) 2023-12-07 09:04:45 +10:00
990_settings.rb DEV: Only warn about invalid email setting in production 2020-04-15 11:21:21 -04:00
990_topics.rb DEV: Apply syntax_tree formatting to db/* 2023-01-09 11:59:41 +00:00