discourse/spec/requests/api
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
..
schemas FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
shared
backups_spec.rb
badges_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
categories_spec.rb
groups_spec.rb
invites_spec.rb
multiple_invites_spec.rb FEATURE: change /invites.json api endpoint to optionally accept array of emails (#24853) 2023-12-28 10:16:04 -05:00
notifications_spec.rb DEV: Block accidental serialization of entire AR models (#27668) 2024-07-01 17:08:48 -03:00
posts_spec.rb DEV: Block accidental serialization of entire AR models (#27668) 2024-07-01 17:08:48 -03:00
private_messages_spec.rb FIX: update id types in API docs to integers (#27412) 2024-06-26 20:44:39 -06:00
rate_limits_spec.rb DEV: Don't enforce per ip rate limits for admin api requests (#27500) 2024-06-17 13:21:11 -05:00
search_spec.rb
site_spec.rb DEV: Document basic-info endpoint (#26471) 2024-04-02 14:53:19 -06:00
tags_spec.rb FIX: update id types in API docs to integers (#27412) 2024-06-26 20:44:39 -06:00
topics_spec.rb FIX: update id types in API docs to integers (#27412) 2024-06-26 20:44:39 -06:00
uploads_spec.rb
user_badges_spec.rb
users_spec.rb FIX: update id types in API docs to integers (#27412) 2024-06-26 20:44:39 -06:00