Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cogs/committee_actions_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,13 @@ async def update_status( # NOTE: Committee role check is not present because no
logger.debug("An invalid status was provided but did not raise an exception.")
return

action_belongs_to_user: bool = str(action.discord_member) == str(ctx.user.id)
if not action_belongs_to_user and not await self.bot.check_user_has_committee_role(
ctx.user
):
await self.command_send_error(ctx, message="You can only change your own actions.")
return

await action.aupdate(status=new_status)

await ctx.respond(
Expand Down Expand Up @@ -389,6 +396,13 @@ async def update_description(
)
return

action_belongs_to_user: bool = str(action.discord_member) == str(ctx.user.id)
if not action_belongs_to_user and not await self.bot.check_user_has_committee_role(
ctx.user
):
await self.command_send_error(ctx, message="You can only change your own actions.")
return

old_description: str = action.description

await action.aupdate(description=new_description)
Expand Down Expand Up @@ -873,6 +887,13 @@ async def delete_action(self, ctx: TeXBotApplicationContext, action_id: str) ->
)
return

action_belongs_to_user: bool = str(action.discord_member) == str(ctx.user.id)
if not action_belongs_to_user and not await self.bot.check_user_has_committee_role(
ctx.user
):
await self.command_send_error(ctx, message="You can only change your own actions.")
return

action_description: str = action.description

await action.adelete()
Expand Down