aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/models/track.py13
-rw-r--r--fietsboek/templates/edit_form.jinja21
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">