From e5325a0392c6151ca707f93b1edbb7882594a36a Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 2 Apr 2024 10:42:06 +0100 Subject: [PATCH] Hide booking URLs on calendar if not logged in --- agenda/travel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agenda/travel.py b/agenda/travel.py index 4825c9c..d3f5975 100644 --- a/agenda/travel.py +++ b/agenda/travel.py @@ -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"] ]