aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-06-30 23:15:02 +0200
committerGravatar kwzrd <[email protected]>2020-06-30 23:15:02 +0200
commit968251660768297383401576902a71f8ac9edada (patch)
treeb4864bf707529891f7232166006efbf6d25ee3dd
parentIncidents: revert latest 2 commits (diff)
Incidents: pass `actioned_by` to `archive`
This is an important piece of information that shall be relayed.
-rw-r--r--bot/cogs/moderation/incidents.py4
-rw-r--r--tests/bot/cogs/moderation/test_incidents.py8
2 files changed, 7 insertions, 5 deletions
diff --git a/bot/cogs/moderation/incidents.py b/bot/cogs/moderation/incidents.py
index 040f2c0c8..580a258fe 100644
--- a/bot/cogs/moderation/incidents.py
+++ b/bot/cogs/moderation/incidents.py
@@ -148,7 +148,7 @@ class Incidents(Cog):
log.debug("Crawl task finished!")
- async def archive(self, incident: discord.Message, outcome: Signal) -> bool:
+ async def archive(self, incident: discord.Message, outcome: Signal, actioned_by: discord.Member) -> bool:
"""
Relay `incident` to the #incidents-archive channel.
@@ -235,7 +235,7 @@ class Incidents(Cog):
log.debug("Reaction was valid, but no action is currently defined for it")
return
- relay_successful = await self.archive(incident, signal)
+ relay_successful = await self.archive(incident, signal, actioned_by=member)
if not relay_successful:
log.trace("Original message will not be deleted as we failed to relay it to the archive")
return
diff --git a/tests/bot/cogs/moderation/test_incidents.py b/tests/bot/cogs/moderation/test_incidents.py
index 2fc9180cf..c2e32fe6b 100644
--- a/tests/bot/cogs/moderation/test_incidents.py
+++ b/tests/bot/cogs/moderation/test_incidents.py
@@ -278,7 +278,9 @@ class TestArchive(TestIncidents):
propagate out of the method, which is just as important.
"""
self.cog_instance.bot.fetch_webhook = AsyncMock(side_effect=mock_404)
- self.assertFalse(await self.cog_instance.archive(incident=MockMessage(), outcome=MagicMock()))
+ self.assertFalse(
+ await self.cog_instance.archive(incident=MockMessage(), outcome=MagicMock(), actioned_by=MockMember())
+ )
async def test_archive_relays_incident(self):
"""
@@ -303,7 +305,7 @@ class TestArchive(TestIncidents):
author=MockUser(name="author_name", avatar_url="author_avatar"),
id=123,
)
- archive_return = await self.cog_instance.archive(incident, outcome=MagicMock(value="A"))
+ archive_return = await self.cog_instance.archive(incident, MagicMock(value="A"), MockMember())
# Check that the webhook was dispatched correctly
webhook.send.assert_called_once_with(
@@ -334,7 +336,7 @@ class TestArchive(TestIncidents):
self.cog_instance.bot.fetch_webhook = AsyncMock(return_value=webhook)
message_from_clyde = MockMessage(author=MockUser(name="clyde the great"))
- await self.cog_instance.archive(message_from_clyde, MagicMock(incidents.Signal))
+ await self.cog_instance.archive(message_from_clyde, MagicMock(incidents.Signal), MockMember())
self.assertNotIn("clyde", webhook.send.call_args.kwargs["username"])