discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Cached Slash Commands aren't updated properly when changing roles via "View Server As Role"

Open JakeRabinowitz opened this issue 2 years ago • 0 comments

Description

When you are using the View Server As Role feature and you change your roles, the slash commands shown as available will not update until you change channels. It seems like it's just an issue with the local cache not clearing.

This happens on the initial load, and any time you use the dropdown to change roles.

Steps to Reproduce

  1. Create a Slash Command (/report)
  2. Create a Role ("Reporter").
  3. In the Permissions V2 UI, change the /report command to only be usable by people with the Reporter role.
  4. Give yourself the "Reporter" role.
  5. Change channels, then try to use the /report command. It will be available. [Correct ✅]
  6. Go to Server Settings > Roles > Default Permissions > select @everyone > "..." menu > View Server As Role.
  7. Try to use the /report command. It will be available [Incorrect ⛔]
  8. Change to a different channel.
  9. Try to use the /report command, it will be unavailable [Correct ✅]
  10. Use the "Select Roles" dropdown at the top and enable the Reporter role.
  11. Try to use the /report command again. It will still be unavailable [Incorrect ⛔].
  12. Change the channel you are looking at and try to use the /report command. It will be available [Correct ✅]

Expected Behavior

When you change roles using View Server As Role, the Application/Slash Commands that are correct for the changed role settings should be immediately available. The locally cached slash commands should be refreshed automatically.

Current Behavior

The Slash Commands to not properly update. You must change channels in order to see the correct Slash Commands.

Screenshots/Videos

In this image "/devtest" is in place of "/report" in the repro steps.

  1. The command is available: Discord_ViewAsRole_Bug_1

  2. You set the permissions to only those with a specific role (here "Feedback Viewer", in repro steps "Reporter". Discord_ViewAsRole_Bug_2

  3. You view the server as "everyone". Discord_ViewAsRole_Bug_3

  4. You can still see the command in the command list. Discord_ViewAsRole_Bug_4

  5. Change channels, command is no longer available. Discord_ViewAsRole_Bug_5

Client and System Information

Tested on Windows Desktop Client

Stable 130832 (367507e) Host 1.0.9004 Windows 10 64-Bit (10.0.19043)

and

Ptb 130866 (7d0dbc4) Host 1.0.1014 Windows 10 64-Bit (10.0.19043)

JakeRabinowitz avatar Jun 04 '22 16:06 JakeRabinowitz