diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-07-01 13:21:13 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-07-01 13:21:13 +0200 |
commit | fdce95009c7fce133ef58bfe9793c93777d12e64 (patch) | |
tree | dc20b5bbb82d0361f318eea8345a5f87f3e3d66c | |
parent | d080806bba1a2bd48d8a3c2a8011ee057a300a3b (diff) | |
download | fietsboek-fdce95009c7fce133ef58bfe9793c93777d12e64.tar.gz fietsboek-fdce95009c7fce133ef58bfe9793c93777d12e64.tar.bz2 fietsboek-fdce95009c7fce133ef58bfe9793c93777d12e64.zip |
add a "logged in" visibility
-rw-r--r-- | fietsboek/models/track.py | 13 | ||||
-rw-r--r-- | fietsboek/templates/edit_form.jinja2 | 1 |
2 files changed, 13 insertions, 1 deletions
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 @@ <select class="form-select" id="formVisibility" name="visibility"> <option value="PRIVATE"{% if visibility.name == "PRIVATE" %} selected{% endif %}>{{ _("page.track.form.visibility.private") }}</option> <option value="FRIENDS"{% if visibility.name == "FRIENDS" %} selected{% endif %}>{{ _("page.track.form.visibility.friends") }}</option> + <option value="LOGGED_IN"{% if visibility.name == "LOGGED_IN" %} selected{% endif %}>{{ _("page.track.form.visibility.logged_in") }}</option> <option value="PUBLIC"{% if visibility.name == "PUBLIC" %} selected{% endif %}>{{ _("page.track.form.visibility.public") }}</option> </select> <p class="text-secondary"> |