Whitelist a thread when its parent is whitelisted#1231
Merged
shtlrs merged 2 commits intoMar 10, 2023
Conversation
mbaruh
reviewed
Mar 10, 2023
| channels = tuple(channels) + (redirect,) | ||
|
|
||
| # If it's a thread, and its parent is whitelisted, we whitelist the thread as well | ||
| if channels and isinstance(ctx.channel, Thread) and ctx.channel.parent_id in channels: |
Member
There was a problem hiding this comment.
Rather than adding the thread to the whitelisted channels, it makes more sense to check the parent channel instead of ctx.channel in this case. This also keeps the in channels check in one place.
Member
There was a problem hiding this comment.
fwiw I usually do a hasattr(ctx.channel, "parent") check whenever I have to do something like this, and save the extra import, but that's more a matter of style.
Contributor
Author
There was a problem hiding this comment.
I just wanted to avoid multiple ifs within each other, but i can do that if you want
Ibrahim2750mi
approved these changes
Mar 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently, we can't execute commands in threads if they're not whitelisted.
The problem is, we can't have a thread id in advance.
This adds the possibility to do that when the parent of the thread is whitelisted (Just like the case of help forum channels)
Context:
This is needed in order of achieving #1230