discourse/spec
Grayden 64ead3c3a1
FIX: Revoking admin or moderator status doesn't require refresh to delete/anonymize/merge user (#14073)
* FIX: Revoking admin or moderator status doesn't require refresh to delete/anonymize/merge user

On the /admin/users/<id>/<username> page, there are action buttons that are either visible or hidden depending on a few fields from the AdminDetailsSerializer: `can_be_deleted`, `can_be_anonymized`, `can_be_merged`, `can_delete_all_posts`.

These fields are updated when granting/revoking admin or moderator status. However, those updates were not being reflected on the page. E.g. if a user is granted moderation privileges, the 'anonymize user' and 'merge' buttons still appear on the page, which is inconsistent with the backend state of the user. It requires refreshing the page to update the state.

This commit fixes that issue, by syncing the client model state with the server state when handling a successful response from the server. Now, when revoking privileges, the buttons automatically appear without refreshing the page. Similarly, when granting moderator privileges, the buttons automatically disappear without refreshing the page.

* Add detailed user response to spec for changed routes.

Add tests to verify that the revoke_moderation, grant_moderation, and revoke_admin routes return a response formatted according to the AdminDetailedUserSerializer.
2021-08-19 09:57:16 +08:00
..
components FIX: Remove markers from all translated languages (#14081) 2021-08-18 19:42:04 +03:00
fabricators FEATURE: Disallow putting urls in the title for TL-0 users (#13947) 2021-08-05 13:38:39 +04:00
fixtures FIX: Remove markers from all translated languages (#14081) 2021-08-18 19:42:04 +03:00
helpers FIX: Assets for the theme tests page are not compressed (#13736) 2021-07-14 22:52:35 +03:00
import_export FEATURE: Rake task to export groups (#9450) 2020-04-17 14:59:54 -07:00
initializers FEATURE: A low priority filter for the review queue. (#12822) 2021-04-23 15:34:24 -03:00
integration DEV: Isolate multisite specs (#13634) 2021-07-07 18:57:42 +02:00
integrity DEV: Fix a flaky Onceoff spec (#13314) 2021-06-07 20:38:31 +02:00
jobs FEATURE: Initial implementation of direct S3 uploads with uppy and stubs (#13787) 2021-07-28 08:42:25 +10:00
lib FIX: Unread group PMs should use `GroupUser#first_unread_pm_at`. (#14075) 2021-08-18 11:23:28 +08:00
mailers FEATURE: Use group SMTP job and mailer instead of UserNotifications change (#13489) 2021-06-28 08:55:13 +10:00
models FIX: log proper error message when SSO nonce verification fails (#14077) 2021-08-18 18:44:12 +05:30
multisite FEATURE: Initial implementation of direct S3 uploads with uppy and stubs (#13787) 2021-07-28 08:42:25 +10:00
requests FIX: Revoking admin or moderator status doesn't require refresh to delete/anonymize/merge user (#14073) 2021-08-19 09:57:16 +08:00
script/import_scripts DEV: If disabled do not change setting after import (#12142) 2021-02-19 09:33:35 -07:00
serializers DEV: Remove flaky topic_view_serializer spec (#13845) 2021-07-26 13:17:53 +10:00
services FIX: remove Nokogumbo references (#13951) 2021-08-05 11:46:25 +10:00
support FIX: Make sure reset-new for tracked is not limited by per_page count (#13395) 2021-06-17 08:20:09 +10:00
tasks FIX: remove migrate_from_s3 task that silently corrupts data (#11703) 2021-01-17 22:33:29 +01:00
views/omniauth_callbacks FEATURE: Use full page redirection for all external auth methods (#8092) 2019-10-08 12:10:43 +01:00
rails_helper.rb Revert "DEV: Move rate limiter disable to after :each for tests (#13986)" (#13987) 2021-08-10 14:12:36 +10:00
swagger_helper.rb DEV: Fix several type issues with the api docs (#14016) 2021-08-12 12:25:17 -06:00