aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2020-03-30 13:36:34 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2020-03-30 13:36:34 +0200
commit582ddbb1ca8bab2cb883781911f5f35962330995 (patch)
tree9eeda53b7ae0fbc0efc11d676ae95ac3c6fc33d7
parentMerge pull request #812 from Numerlor/hush-cog (diff)
Set unsilence permissions to inherit instead of true
The "unsilence" action of the silence/hush command used `send_messages=True` when unsilencing a hushed channel. This had the side effect of also enabling send messages permissions for those with the Muted rule, as an explicit True permission apparently overwrites an explicit False permission, even if the latter was set for a higher top-role. The solution is to revert back to the `Inherit` permission by assigning `None`. This is what we normally use when Developers are allowed to send messages to a channel.
-rw-r--r--bot/cogs/moderation/silence.py2
-rw-r--r--tests/bot/cogs/moderation/test_silence.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/bot/cogs/moderation/silence.py b/bot/cogs/moderation/silence.py
index a1446089e..1ef3967a9 100644
--- a/bot/cogs/moderation/silence.py
+++ b/bot/cogs/moderation/silence.py
@@ -138,7 +138,7 @@ class Silence(commands.Cog):
"""
current_overwrite = channel.overwrites_for(self._verified_role)
if current_overwrite.send_messages is False:
- await channel.set_permissions(self._verified_role, **dict(current_overwrite, send_messages=True))
+ await channel.set_permissions(self._verified_role, **dict(current_overwrite, send_messages=None))
log.info(f"Unsilenced channel #{channel} ({channel.id}).")
self.notifier.remove_channel(channel)
self.muted_channels.discard(channel)
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py
index 44682a1bd..3fd149f04 100644
--- a/tests/bot/cogs/moderation/test_silence.py
+++ b/tests/bot/cogs/moderation/test_silence.py
@@ -194,7 +194,7 @@ class SilenceTests(unittest.IsolatedAsyncioTestCase):
channel = MockTextChannel(overwrites_for=Mock(return_value=perm_overwrite))
self.assertTrue(await self.cog._unsilence(channel))
channel.set_permissions.assert_called_once()
- self.assertTrue(channel.set_permissions.call_args.kwargs['send_messages'])
+ self.assertIsNone(channel.set_permissions.call_args.kwargs['send_messages'])
@mock.patch.object(Silence, "notifier", create=True)
async def test_unsilence_private_removed_notifier(self, notifier):