From f9301892c5b713a2471fb057d1905941ffc05d44 Mon Sep 17 00:00:00 2001 From: Toby Jones Date: Thu, 5 Oct 2023 10:59:53 +0100 Subject: [PATCH] fix docker compose add support for cancelling a pending verification using /unverify --- docker-compose.yml | 11 +++++++++++ harmony_cogs/verify.py | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4b4e56b..bc57770 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,12 +8,23 @@ services: - type: bind source: ./config.json target: /botapp/config.json + networks: + - harmony mongodb: image: "mongo:7.0.2" + command: --replSet rs01 --bind_ip localhost,harmony-db container_name: "harmony-db" ports: - "127.0.0.1:27020:27017" env_file: - .env.mongodb + networks: + - harmony + volumes: + - type: bind + source: ./db + target: /data/db +networks: + harmony: \ No newline at end of file diff --git a/harmony_cogs/verify.py b/harmony_cogs/verify.py index 3b20118..b636aa1 100644 --- a/harmony_cogs/verify.py +++ b/harmony_cogs/verify.py @@ -161,6 +161,7 @@ class UnverifyConfirmationModal(discord.ui.Modal, title="Enter your Reddit usern async def unverify(self, interaction: discord.Interaction): verification_data = harmony_db.get_verification_data(interaction.user.id) + reddit_username = self.reddit_username_field.value reddit_username = reddit_username.replace('u/', '') @@ -228,6 +229,11 @@ async def display_verification_dialog(self, interaction: discord.Interaction) -> async def display_unverify_dialog(self, interaction: discord.Interaction): if harmony_db.has_verification_data(interaction.user.id): await interaction.response.send_modal(UnverifyConfirmationModal()) + elif harmony_db.has_pending_verification(interaction.user.id): + pending_verification = harmony_db.get_pending_verification(interaction.user.id) + pending_verification.delete() + await interaction.response.send_message( + "Your pending verification has been cancelled. You can `/verify` again at any time.", ephemeral=True) else: await interaction.response.send_message("Doesn't look like you're verified.", ephemeral=True)