From fdce95009c7fce133ef58bfe9793c93777d12e64 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 1 Jul 2022 13:21:13 +0200 Subject: add a "logged in" visibility --- fietsboek/models/track.py | 13 ++++++++++++- fietsboek/templates/edit_form.jinja2 | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fietsboek/models/track.py b/fietsboek/models/track.py index 5089a7a..16c6ff0 100644 --- a/fietsboek/models/track.py +++ b/fietsboek/models/track.py @@ -55,10 +55,19 @@ class TagBag(TypeDecorator): class Visibility(enum.Enum): - """An enum that represents the visibility of tracks.""" + """An enum that represents the visibility of tracks. + + Note that the track is always visible to tagged people and via the sharing + link. + """ PRIVATE = enum.auto() + """Only the owner of the track can see it.""" FRIENDS = enum.auto() + """Friends of the owner can see the track as well.""" + LOGGED_IN = enum.auto() + """Any logged in user can see the track.""" PUBLIC = enum.auto() + """Anyone can see the track.""" track_people_assoc = Table( @@ -166,6 +175,8 @@ class Track(Base): # logged in user is a friend. if self.visibility == Visibility.FRIENDS: return user in self.owner.get_friends() + if user and self.visibility == Visibility.LOGGED_IN: + return True return False def ensure_cache(self): diff --git a/fietsboek/templates/edit_form.jinja2 b/fietsboek/templates/edit_form.jinja2 index 0a52319..2406c86 100644 --- a/fietsboek/templates/edit_form.jinja2 +++ b/fietsboek/templates/edit_form.jinja2 @@ -12,6 +12,7 @@

-- cgit v1.2.3