discourse/app/assets/javascripts/admin/addon/models
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
..
admin-dashboard.js FEATURE: Add new features section in admin dashboard (#11731) 2021-01-22 10:09:02 -05:00
admin-user.js FIX: Revoking admin or moderator status doesn't require refresh to delete/anonymize/merge user (#14073) 2021-08-19 09:57:16 +08:00
api-key.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
backup-status.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
backup.js FIX: remove rendering UX from ember models (#11724) 2021-01-20 16:04:21 +11:00
color-scheme-color.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
color-scheme.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
email-log.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
email-preview.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
email-settings.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
email-style.js REFACTOR: Support bundling our `admin` section as an ember addon 2020-09-22 15:14:29 -04:00
email-template.js DEV: Don't use the Ember global (#13535) 2021-06-29 19:54:18 +02:00
flag-type.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
incoming-email.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
permalink.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
report.js FIX: ensures average is applied on last incomplete segment (#13472) 2021-06-22 12:26:52 +02:00
screened-email.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
screened-ip-address.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
screened-url.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
site-setting.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
site-text.js UX: Text customization for different languages. (#11729) 2021-01-18 14:53:45 -03:00
staff-action-log.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
theme-settings.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
theme.js FIX: Show unassigned component warning when installing multiple components successively (#11675) 2021-01-11 18:29:12 +03:00
tl3-requirements.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
user-field.js FEATURE: add multiselect user custom field (#13560) 2021-06-29 16:29:25 +10:00
version-check.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
watched-word.js DEV: Simplify watched word code (#13103) 2021-05-27 19:20:26 +03:00
web-hook.js DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00