Hide booking URLs on calendar if not logged in

This commit is contained in:
Edward Betts 2024-04-02 10:42:06 +01:00
parent 7208e10cb2
commit e5325a0392

View file

@ -3,6 +3,7 @@
import os
import typing
import flask
import yaml
from .types import Event
@ -26,7 +27,7 @@ def get_flights(data_dir: str) -> list[Event]:
end_date=item.get("arrive"),
name="transport",
title=f'✈️ {item["from"]} to {item["to"]} ({flight_number(item)})',
url=item.get("url"),
url=(item.get("url") if flask.g.user.is_authenticated else None),
)
for item in parse_yaml("flights", data_dir)
if item["depart"].date()
@ -43,7 +44,7 @@ def get_trains(data_dir: str) -> list[Event]:
end_date=leg["arrive"],
name="transport",
title=f'🚆 {leg["from"]} to {leg["to"]}',
url=item.get("url"),
url=(item.get("url") if flask.g.user.is_authenticated else None),
)
for leg in item["legs"]
]