discourse/spec
Ted Johansson e74560f062
FIX: Don't mix up action labels between different reviewables (#23365)
Currently, if the review queue has both a flagged post and a flagged chat message, one of the two will have some of the labels of their actions replaced by those of the other. In other words, the labels are getting mixed up. For example, a flagged chat message might show up with an action labelled "Delete post".

This is happening because when using bundles, we are sending along the actions in a separate part of the response, so they can be shared by many reviewables. The bundles then index into this bag of actions by their ID, which is something generic describing the server action, e.g. "agree_and_delete".

The problem here is the same action can have different labels depending on the type of reviewable. Now that the bag of actions contains multiple actions with the same ID, which one is chosen is arbitrary. I.e. it doesn't distinguish based on the type of the reviewable.

This change adds an additional field to the actions, server_action, which now contains what used to be the ID. Meanwhile, the ID has been turned into a concatenation of the reviewable type and the server action, e.g. post-agree_and_delete.

This still provides the upside of denormalizing the actions while allowing for different reviewable types to have different labels and descriptions.

At first I thought I would prepend the reviewable type to the ID, but this doesn't work well because the ID is used on the server-side to determine which actions are possible, and these need to be shared between different reviewables. Hence the introduction of server_action, which now serves that purpose.

I also thought about changing the way that the bundle indexes into the bag of actions, but this is happening through some EmberJS mechanism, so we don't own that code.
2023-09-06 10:57:30 +08:00
..
fabricators FEATURE: support to initial values for form templates through /new-topic (#23313) 2023-08-29 18:41:33 -03:00
fixtures DEV: Add email fixture (#23364) 2023-09-01 16:29:47 +10:00
helpers DEV: Update application_helper_spec following 1bd00076 (#23413) 2023-09-05 20:56:03 +01:00
import_export DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
initializers DEV: Fix test (#22018) 2023-06-08 16:12:13 -05:00
integration DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
integrity DEV: Remove enable_experimental_hashtag_autocomplete logic (#22820) 2023-08-08 11:18:55 +10:00
jobs FIX: correct bulk invite expire time for DST (#23073) 2023-08-18 12:33:40 -04:00
lib FEATURE: Secure uploads in PMs only (#23398) 2023-09-06 09:39:09 +10:00
mailers FIX: Order tags shown in email subject by topics count and name (#22586) 2023-07-13 15:39:58 +08:00
models FIX: Don't mix up action labels between different reviewables (#23365) 2023-09-06 10:57:30 +08:00
multisite DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
requests DEV: Handle bad parameters in TopicsController#wordpress (#23404) 2023-09-05 16:35:46 +08:00
script/import_scripts DEV: Fix flaky core backend spec (#22650) 2023-07-18 07:01:19 +08:00
serializers DEV: Include context question for chat reviewables (#23332) 2023-09-05 10:11:39 +08:00
services FIX: Delete fast typer reviewable when deleting user (#23162) 2023-08-21 18:03:03 +08:00
support FEATURE: Secure uploads in PMs only (#23398) 2023-09-06 09:39:09 +10:00
system FEATURE: Secure uploads in PMs only (#23398) 2023-09-06 09:39:09 +10:00
tasks FEATURE: Secure uploads in PMs only (#23398) 2023-09-06 09:39:09 +10:00
views DEV: Fix random typos (#22078) 2023-06-13 22:02:21 +02:00
rails_helper.rb DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
regenerate_swagger_docs
swagger_helper.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00