Add inline documents and messages to I1 checklist
This commit is contained in:
@@ -505,6 +505,13 @@ def employee_hr_dashboard(request: Request):
|
||||
db.close()
|
||||
|
||||
|
||||
def _safe_employee_return_url(value: str | None, fallback: str) -> str:
|
||||
candidate = (value or "").strip()
|
||||
if candidate.startswith("/") and not candidate.startswith("//"):
|
||||
return candidate
|
||||
return fallback
|
||||
|
||||
|
||||
@router.get("")
|
||||
def employees_list(request: Request, q: str = "", include_inactive: str | None = None, link_status: str = "all"):
|
||||
db = CommonSessionLocal()
|
||||
@@ -2348,7 +2355,8 @@ def employee_work_task_communication(
|
||||
communication_types=TASK_COMMUNICATION_TYPES,
|
||||
communication_visibilities=TASK_COMMUNICATION_VISIBILITIES,
|
||||
post_url=f"/employees/work/tasks/{task_id}/communication",
|
||||
back_url="/employees/work",
|
||||
back_url=_safe_employee_return_url(request.query_params.get("return_to"), "/employees/work"),
|
||||
return_to=_safe_employee_return_url(request.query_params.get("return_to"), "/employees/work"),
|
||||
is_employee_self=False,
|
||||
errors=[],
|
||||
)
|
||||
@@ -2363,6 +2371,7 @@ def employee_work_task_add_communication(
|
||||
comment_type: str = Form("internal_note"),
|
||||
visibility: str = Form("internal"),
|
||||
message: str = Form(...),
|
||||
return_to: str = Form(""),
|
||||
csrf_token: str = Form(...),
|
||||
):
|
||||
db = CommonSessionLocal()
|
||||
@@ -2391,7 +2400,7 @@ def employee_work_task_add_communication(
|
||||
actor_user_id=current_user.id,
|
||||
financial_year=_active_financial_year(request),
|
||||
)
|
||||
return RedirectResponse(url=f"/employees/work/tasks/{task_id}/communication", status_code=303)
|
||||
return RedirectResponse(url=_safe_employee_return_url(return_to, f"/employees/work/tasks/{task_id}/communication"), status_code=303)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@@ -2425,7 +2434,8 @@ def employee_my_work_task_communication(
|
||||
communication_types=TASK_COMMUNICATION_TYPES,
|
||||
communication_visibilities=TASK_COMMUNICATION_VISIBILITIES,
|
||||
post_url=f"/employee/work/tasks/{task_id}/communication",
|
||||
back_url="/employee/work",
|
||||
back_url=_safe_employee_return_url(request.query_params.get("return_to"), "/employee/work"),
|
||||
return_to=_safe_employee_return_url(request.query_params.get("return_to"), "/employee/work"),
|
||||
is_employee_self=True,
|
||||
errors=[],
|
||||
financial_year=financial_year,
|
||||
@@ -2441,6 +2451,7 @@ def employee_my_work_task_add_communication(
|
||||
comment_type: str = Form("internal_note"),
|
||||
visibility: str = Form("internal"),
|
||||
message: str = Form(...),
|
||||
return_to: str = Form(""),
|
||||
csrf_token: str = Form(...),
|
||||
):
|
||||
db = CommonSessionLocal()
|
||||
@@ -2470,7 +2481,7 @@ def employee_my_work_task_add_communication(
|
||||
assigned_only=True,
|
||||
financial_year=_active_financial_year(request),
|
||||
)
|
||||
return RedirectResponse(url=f"/employee/work/tasks/{task_id}/communication", status_code=303)
|
||||
return RedirectResponse(url=_safe_employee_return_url(return_to, f"/employee/work/tasks/{task_id}/communication"), status_code=303)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user