No longer assume fields are empty

This commit is contained in:
Zeva Rose 2022-05-03 16:25:37 -06:00
parent 714fd36fef
commit 691285a78e

View file

@ -55,7 +55,7 @@ class CaseCog(Cog):
action_output = ""
action_output_extra = ""
for idx, action in enumerate(mod_case.actions or []):
for idx, action in enumerate(mod_case.actions):
parent_action = await ACTIONS_LOOKUP[action.action_type].find_one(q(id=action.parent))
if not parent_action:
action.orphaned = True
@ -78,7 +78,7 @@ class CaseCog(Cog):
note_output = ""
note_output_extra = ""
notes = sorted(mod_case.notes or [], key=lambda x: x.created_at)
notes = sorted(mod_case.notes, key=lambda x: x.created_at)
for idx, note in enumerate(notes):
admin = await self.bot.fetch_user(note.admin)
admin_text = "[N/A]"
@ -322,7 +322,9 @@ class CaseCog(Cog):
note = Note(admin=ctx.author.id, content=note)
case = Modlog(user=user.id, guild=ctx.guild.id, admin=ctx.author.id, notes=[note])
case = Modlog(
user=user.id, guild=ctx.guild.id, admin=ctx.author.id, notes=[note], actions=[]
)
await case.commit()
await case.reload()