Skip to content

Commit ab683be

Browse files
committed
fix: should allow volunteer permission to verify the activity
1 parent 1bbce32 commit ab683be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

routers/activities_v2_router.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ async def modify_activity_status_v2(
400400
if not target_activity:
401401
raise HTTPException(status_code=404, detail="Activity not found")
402402

403-
if target_activity["status"] != "pending":
403+
target_activity = Activity.model_validate(target_activity, strict=False)
404+
405+
if target_activity.status != "pending":
404406
raise HTTPException(
405407
status_code=400,
406408
detail="Activity status can only be modified from pending to effective or refused",
@@ -417,7 +419,7 @@ async def modify_activity_status_v2(
417419
raise HTTPException(status_code=404, detail="Activity not found")
418420

419421
log.with_text(
420-
f'User {await get_user_name(user["id"])} updated activity {target_activity["name"]} at {datetime.now().isoformat()}. The ID of the activity is {activity_id}.'
422+
f'User {await get_user_name(user["id"])} updated activity {target_activity.name} at {datetime.now().isoformat()}. The ID of the activity is {activity_id}.'
421423
)
422424
await log.insert_log()
423425

0 commit comments

Comments
 (0)