Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document permission splits for expressions and events #6305

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

advaith1
Copy link
Contributor

@advaith1 advaith1 commented Jul 17, 2023

hi im back

New permission flags:

  • CREATE_GUILD_EXPRESSIONS: 1 << 43
  • CREATE_EVENTS: 1 << 44

This PR:

  • Updates the permissions table to include the new perms and edit the descriptions
  • Updates the emoji and sticker endpoint permission info
  • Updates the scheduled event permissions section to clarify it and reflect the permission updates
  • Adds a changelog for the change

Warning
Bots currently still use the old permission system, unless they send a recent X-Super-Properties header. This PR does not reflect this fact and only documents the new system.
EDIT 8/13: this change seems to affect bots now
EDIT: this change was reverted for bots

Other notes:

  • The client incorrectly allows you to create events if you have MANAGE_EVENTS but not CREATE_EVENTS, but the API rejects the request.
  • For bots with CREATE_GUILD_EXPRESSIONS but not MANAGE_GUILD_EXPRESSIONS, the user field is always included in List Guild Emojis, List Guild Stickers, and Get Guild Sticker, but not in Get Guild Emoji. Ideally, the last endpoint is changed to be consistent with the others. This PR documents the current behavior.

resolves #6298

@valdotle
Copy link
Contributor

Also, should #6260 be updated in order to reflect these changes or will you include the permission changes in whatever PR gets merged last or make an entirely new one?

@andretran
Copy link

andretran commented Jul 17, 2023

Hey @advaith1

I was the engineer who worked on the permissions split. I'm going to address your notes to:

  1. Patch the UI bug allowing you to go through the create event flow if you only have MANAGE_GUILD_EXPRESSIONS
  2. Make the GET Guild Emoji endpoint consistent with the other endpoints.

I'll give you a re-review once these are both addressed and we update the docs.

@andretran
Copy link

andretran commented Jul 21, 2023

@advaith1
Following up with you.

  1. Should be fixed now
  2. I'm not going to change the current API behavior because I think it's designed as intended.

However the behavior around fetching is slightly more complicated. To clarify, this is what happens:

  • GET - List Guild Emojis

    • If bot, we return you a list of emojis uploaded by the bot (don't need to serialize user here since all the emojis should belong to the bot)

    • if not bot, we return you all guild emojis and serialize the user only if it belongs to you and you have create permissions OR we attach the user to all emojis if you have manage permissions

    • GET - Guild Emoji

      • We return you a specific guild emoji and serialize the user if it belongs you and you have create permissions OR you have manage permissions (regardless if you're a bot or not)
  • Both GET List Guild stickers and GET Guild Sticker behavior similarly to GET Guild Emoji

docs/resources/Emoji.md Show resolved Hide resolved
@advaith1
Copy link
Contributor Author

advaith1 commented Aug 9, 2023

@andretran I'm confused, your comment doesn't describe how the API currently works or ever worked. The list emojis/stickers endpoints always returned all emojis/stickers, even ones created by other users, and bots rely on this behavior. There has never been separate behavior for bots on that endpoint AFAIK. The list endpoints have also always returned user objects as long as you have Manage Expressions.

Get Guild Emoji is still giving me responses inconsistent with the other 3 endpoints I mentioned.

@colinloretz colinloretz self-requested a review November 15, 2023 18:37
@colinloretz colinloretz self-assigned this Nov 15, 2023
Copy link
Contributor

@colinloretz colinloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back around to this one -- far too late, thanks for the work on this @advaith1.

Confirmed that what you are seeing and how the API is doing is expected. Will get this merged.

@colinloretz colinloretz merged commit ff5e9d5 into discord:main Nov 15, 2023
3 checks passed
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request Feb 5, 2024
shaydewael pushed a commit to Jupith/discord-api-docs that referenced this pull request May 14, 2024
* Document permission splits for expressions and events

* Added info callout for docs delay

---------

Co-authored-by: Colin Loretz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Create Events" permission introduced unannounced and undocumented
4 participants