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:
parent
712a0ad631
commit
08f4cd2274
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
|
||||
from typing import Optional
|
||||
from files.__main__ import app
|
||||
from files.classes.comment import Comment
|
||||
from files.classes.flags import CommentFlag
|
||||
|
@ -33,7 +34,7 @@ class VolunteerDutyJanitor(VolunteerDuty):
|
|||
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']:
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue