Skip to content

Commit

Permalink
fix(PWA): strip html tags in holiday descriptions (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal authored May 30, 2024
1 parent 6f8d28c commit 29737bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hrms/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from frappe import _
from frappe.model.workflow import get_workflow_name
from frappe.query_builder import Order
from frappe.utils import getdate
from frappe.utils import getdate, strip_html

SUPPORTED_FIELD_TYPES = [
"Link",
Expand Down Expand Up @@ -207,13 +207,18 @@ def get_holidays_for_employee(employee: str) -> list[dict]:
return []

Holiday = frappe.qb.DocType("Holiday")
return (
holidays = (
frappe.qb.from_(Holiday)
.select(Holiday.name, Holiday.holiday_date, Holiday.description)
.where((Holiday.parent == holiday_list) & (Holiday.weekly_off == 0))
.orderby(Holiday.holiday_date, order=Order.asc)
).run(as_dict=True)

for holiday in holidays:
holiday["description"] = strip_html(holiday["description"] or "").strip()

return holidays


@frappe.whitelist()
def get_leave_approval_details(employee: str) -> dict:
Expand Down

0 comments on commit 29737bb

Please sign in to comment.