fix(GuildChannel): make lockPermissions use parent overwrites #4627
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe the changes this PR makes and why it should be merged:
I decided to make this (original) PR separate from #4598 since it allows a quick fix of the issue at hand in case the required Discord API documentation takes more time than anticipated. The client handles this situation differently, however. After documentation on the API documentation this will be applied as a feature in #4598.
Should #4598 me merged before this issue will auto-close as it is obsolete.
as #4144 has brought to light the
lockPermissionsoption in GuildChannel#setParent (and as direct cause GuildChannel#edit) does currently not lock permissions.I tracked this down due to the API no longer accepting a
lock_permissionsfield when patching a channel as per https://discord.com/developers/docs/resources/channel#modify-channel, which is how the feature is currently implemented as of #1727discord.js/src/structures/GuildChannel.js
Lines 340 to 353 in ae71687
Since locking permissions really just means replacing the channels overwrites with its parents (or future parents) overwrites this proposed solution resolves these overwrites based on the current state and provides them (if applicable along with the new parent) in the patch data.
Considerations/Assumptions made:
this.parentStatus
Semantic versioning classification: