Skip to content

Modlog ignore channels mods can't view#1871

Merged
ChrisLovering merged 4 commits into
mainfrom
modlog-ingore-channels-mods-can't-view
Oct 17, 2021
Merged

Modlog ignore channels mods can't view#1871
ChrisLovering merged 4 commits into
mainfrom
modlog-ingore-channels-mods-can't-view

Conversation

@ChrisLovering
Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering commented Oct 14, 2021

Description

The main purpose of this is so that we don't need to keep adding to the modlog_blacklist for every new channel we want to ignore, since it now implicitly ignores channels mods don't have read perms to.

This is done by making use of Discord.py 2.0's updated behaviour of Channel.permissions_for() where it can now accept a role and determines the permissions of users in that role for a given channel. This takes into account default permissions as well as channel overrides.

Due to this new approach of implicitly ignoring these channels, we can also remove some entries in the config file.

@ChrisLovering ChrisLovering changed the base branch from main to discord-2.0 October 14, 2021 15:33
@Akarys42 Akarys42 added the review: do not merge The PR can be reviewed but cannot be merged now label Oct 14, 2021
@ChrisLovering ChrisLovering added a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: moderation Related to community moderation functionality: (moderation, defcon, verification) p: 2 - normal Normal Priority s: needs review Author is waiting for someone to review and approve t: enhancement Changes or improvements to existing features labels Oct 14, 2021
@Xithrius Xithrius changed the title Modlog ingore channels mods can't view Modlog ignore channels mods can't view Oct 14, 2021
@ChrisLovering ChrisLovering marked this pull request as draft October 14, 2021 19:52
Base automatically changed from discord-2.0 to main October 17, 2021 08:16
@ChrisLovering ChrisLovering force-pushed the modlog-ingore-channels-mods-can't-view branch from e934919 to 85f3510 Compare October 17, 2021 08:30
@ChrisLovering ChrisLovering marked this pull request as ready for review October 17, 2021 08:31
@ChrisLovering ChrisLovering removed the review: do not merge The PR can be reviewed but cannot be merged now label Oct 17, 2021
Copy link
Copy Markdown
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you mister Chris! Best ᵂelsh engineer I've ever seen!

Copy link
Copy Markdown
Contributor

@Xithrius Xithrius left a comment

Choose a reason for hiding this comment

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

Otherwise lgtm yes yes

Comment thread bot/exts/moderation/modlog.py Outdated
@ChrisLovering ChrisLovering force-pushed the modlog-ingore-channels-mods-can't-view branch from 4385112 to 72a72bf Compare October 17, 2021 08:50
Copy link
Copy Markdown
Contributor

@Xithrius Xithrius left a comment

Choose a reason for hiding this comment

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

mmmmmmmmmmmmmmmmmm

Comment thread bot/exts/moderation/modlog.py
Comment thread bot/exts/moderation/modlog.py Outdated
Comment thread bot/exts/moderation/modlog.py Outdated
ChrisLovering and others added 4 commits October 17, 2021 09:55
The main purpose of this is so that we don't need to keep adding to the modlog_blacklist for every new channel we want to ignore, since it now implicitly ignores channels mods don't have read perms to.

This  is done by making use of Discord.py 2.0's updated behaviour of Channel.permissions_for() where it can now accept a role and determines the permissions of users in that role for a given channel. This takes into account default permissions as well as channel overrides.

Co-authored-by: Xithrius <xithrius@gmail.com>
This new name better describes what this function actually does
Since channels that mods can't read are now implicitly ignored, there is no need to explicitly ignore them.
@ChrisLovering ChrisLovering force-pushed the modlog-ingore-channels-mods-can't-view branch from 72a72bf to 2b8807b Compare October 17, 2021 08:56
Copy link
Copy Markdown
Contributor

@Xithrius Xithrius left a comment

Choose a reason for hiding this comment

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

Ok now I approve

@ChrisLovering ChrisLovering merged commit 432b571 into main Oct 17, 2021
@ChrisLovering ChrisLovering deleted the modlog-ingore-channels-mods-can't-view branch October 17, 2021 08:58
@Xithrius Xithrius removed the s: needs review Author is waiting for someone to review and approve label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: moderation Related to community moderation functionality: (moderation, defcon, verification) hacktoberfest-accepted p: 2 - normal Normal Priority t: enhancement Changes or improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants