Skip to content

Add commands to turn automatic review posting on or off#1705

Merged
mbaruh merged 7 commits into
python-discord:mainfrom
wookie184:autoreview-toggle
Aug 3, 2021
Merged

Add commands to turn automatic review posting on or off#1705
mbaruh merged 7 commits into
python-discord:mainfrom
wookie184:autoreview-toggle

Conversation

@wookie184
Copy link
Copy Markdown
Contributor

We may want to temporarily stop new nomination reviews from being automatically posted, so this PR creates three new commands, tp autoreview on, tp autoreview off, and tp autoreview status, all with fairly self-explanatory names, I think :)

This uses RedisCache to store the status so it can be persisted over restarts.

@wookie184 wookie184 added a: recruitment Related to recruitment: (talentpool) p: 1 - high High Priority t: feature New feature or request labels Aug 1, 2021
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py
@wookie184 wookie184 requested review from Bluenix2 and MarkKoz August 2, 2021 16:49
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Comment thread bot/exts/recruitment/talentpool/_cog.py Outdated
Copy link
Copy Markdown
Contributor

@MarkKoz MarkKoz left a comment

Choose a reason for hiding this comment

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

The commands don't check the current status, causing them to sometimes perform redundant operations. For example, if autoreview is already enabled, then an enable command will still cause all reviews to be rescheduled. What do you think about adding a check to avoid that?

Apart from that, this would be ready for approval from me. My tests have shown everything is working.

@wookie184 wookie184 requested review from Bluenix2 and MarkKoz August 3, 2021 11:28
Copy link
Copy Markdown
Contributor

@Bluenix2 Bluenix2 left a comment

Choose a reason for hiding this comment

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

Should we have punctuation? As in, ":x: Autoreview is already disabled." (currently missing).

Comment on lines +101 to +105
"""Show whether automatic posting of reviews is enabled or disabled."""
if await self.autoreview_enabled():
await ctx.send("Autoreview is currently enabled")
else:
await ctx.send("Autoreview is currently disabled")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"""Show whether automatic posting of reviews is enabled or disabled."""
if await self.autoreview_enabled():
await ctx.send("Autoreview is currently enabled")
else:
await ctx.send("Autoreview is currently disabled")
"""Show whether automatic posting of reviews is enabled or disabled."""
status = "enabled" if await self.autoreview_enabled() else "disabled"
await ctx.send(f"Autoreview is currently {status}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Neither seems preferable over the other to me. Your suggestion looks neater but the one liner is maybe slightly less readable.

Comment thread bot/exts/recruitment/talentpool/_cog.py
@wookie184
Copy link
Copy Markdown
Contributor Author

Should we have punctuation? As in, ":x: Autoreview is already disabled." (currently missing).

The rest of the cog doesn't seem to include full stops, and I don't think it matters too much anyway, so I don't think so, no.

Copy link
Copy Markdown
Member

@mbaruh mbaruh left a comment

Choose a reason for hiding this comment

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

:shipit:

@mbaruh mbaruh enabled auto-merge August 3, 2021 19:13
@mbaruh mbaruh merged commit 4aaf2bb into python-discord:main Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: recruitment Related to recruitment: (talentpool) p: 1 - high High Priority t: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants