fix: volunteer duties can be None

make sure return type is correct so callees don't get an unexpected `None`
This commit is contained in:
justcool393 2023-01-08 22:41:32 -06:00 committed by Ben Rog-Wilhelm
parent 712a0ad631
commit 08f4cd2274

View file

@ -1,4 +1,5 @@
from typing import Optional
from files.__main__ import app from files.__main__ import app
from files.classes.comment import Comment from files.classes.comment import Comment
from files.classes.flags import CommentFlag from files.classes.flags import CommentFlag
@ -33,7 +34,7 @@ class VolunteerDutyJanitor(VolunteerDuty):
return g.db.query(Comment).where(Comment.id.in_(self.choices)) return g.db.query(Comment).where(Comment.id.in_(self.choices))
def get_duty(u: User) -> VolunteerDutyJanitor: def get_duty(u: User) -> Optional[VolunteerDutyJanitor]:
if not app.config['VOLUNTEER_JANITOR_ENABLE']: if not app.config['VOLUNTEER_JANITOR_ENABLE']:
return None return None