Hide booking URLs on calendar if not logged in
This commit is contained in:
parent
7208e10cb2
commit
e5325a0392
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
import flask
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from .types import Event
|
from .types import Event
|
||||||
|
@ -26,7 +27,7 @@ def get_flights(data_dir: str) -> list[Event]:
|
||||||
end_date=item.get("arrive"),
|
end_date=item.get("arrive"),
|
||||||
name="transport",
|
name="transport",
|
||||||
title=f'✈️ {item["from"]} to {item["to"]} ({flight_number(item)})',
|
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)
|
for item in parse_yaml("flights", data_dir)
|
||||||
if item["depart"].date()
|
if item["depart"].date()
|
||||||
|
@ -43,7 +44,7 @@ def get_trains(data_dir: str) -> list[Event]:
|
||||||
end_date=leg["arrive"],
|
end_date=leg["arrive"],
|
||||||
name="transport",
|
name="transport",
|
||||||
title=f'🚆 {leg["from"]} to {leg["to"]}',
|
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"]
|
for leg in item["legs"]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue