diff --git a/server/planning/assignments/assignments.py b/server/planning/assignments/assignments.py index 309d28f1e..76790564a 100644 --- a/server/planning/assignments/assignments.py +++ b/server/planning/assignments/assignments.py @@ -67,7 +67,7 @@ from planning.common import format_address, get_assginment_name from apps.content import push_content_notification from .assignments_history import ASSIGNMENT_HISTORY_ACTIONS -from planning.utils import get_event_formatted_dates, get_formatted_contacts +from planning.utils import get_event_formatted_dates, get_formatted_contacts, update_event_item_with_translations_value from superdesk.preferences import get_user_notification_preferences logger = logging.getLogger(__name__) @@ -472,6 +472,12 @@ def send_assignment_notification(self, updates, original=None, force=False): formatted_contacts = get_formatted_contacts(event_item) if event_item else [] fomatted_event_date = get_event_formatted_dates(event_item) if event_item else "" + event_item = ( + update_event_item_with_translations_value(event_item, assignment.get("planning", {}).get("language")) + if event_item + else None + ) + # The assignment is to an external contact or a user if assigned_to.get("contact") or assigned_to.get("user"): # If it is a reassignment diff --git a/server/planning/utils.py b/server/planning/utils.py index 07679f0f2..0d24ac182 100644 --- a/server/planning/utils.py +++ b/server/planning/utils.py @@ -100,3 +100,14 @@ def get_event_formatted_dates(event: Dict[str, Any]) -> str: return "{} {}".format(time_short(start, tz), date_short(start, tz)) return "{} - {}, {}".format(time_short(start, tz), time_short(end, tz), date_short(start, tz)) + + +def update_event_item_with_translations_value(event_item: Dict[str, Any], language: str) -> Dict[str, Any]: + if not event_item.get("translations") or not language: + return event_item + updated_event_item = event_item.copy() + for translation in event_item["translations"]: + if translation["language"] == language: + updated_event_item[translation["field"]] = translation["value"] + + return updated_event_item