diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-07-02 17:15:12 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-07-02 17:15:12 +0200 |
commit | aac08f66bad5e2d2488c9aeb6e38cd7e1f8a32ce (patch) | |
tree | f17d95b69f047be35562c97210527fdf7a68ddf7 | |
parent | 5f67e82b8c091f6544514b147e0de24ca9561cad (diff) | |
download | fietsboek-aac08f66bad5e2d2488c9aeb6e38cd7e1f8a32ce.tar.gz fietsboek-aac08f66bad5e2d2488c9aeb6e38cd7e1f8a32ce.tar.bz2 fietsboek-aac08f66bad5e2d2488c9aeb6e38cd7e1f8a32ce.zip |
add a "friends of tagged people" visibility
-rw-r--r-- | fietsboek/locale/en/LC_MESSAGES/messages.mo | bin | 8594 -> 8731 bytes | |||
-rw-r--r-- | fietsboek/locale/en/LC_MESSAGES/messages.po | 71 | ||||
-rw-r--r-- | fietsboek/locale/fietslog.pot | 64 | ||||
-rw-r--r-- | fietsboek/models/track.py | 11 | ||||
-rw-r--r-- | fietsboek/templates/edit_form.jinja2 | 1 |
5 files changed, 83 insertions, 64 deletions
diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.mo b/fietsboek/locale/en/LC_MESSAGES/messages.mo Binary files differindex a31f469..3343b6f 100644 --- a/fietsboek/locale/en/LC_MESSAGES/messages.mo +++ b/fietsboek/locale/en/LC_MESSAGES/messages.mo diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.po b/fietsboek/locale/en/LC_MESSAGES/messages.po index a9ce00f..c402e05 100644 --- a/fietsboek/locale/en/LC_MESSAGES/messages.po +++ b/fietsboek/locale/en/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-07-02 00:40+0200\n" +"POT-Creation-Date: 2022-07-02 17:11+0200\n" "PO-Revision-Date: 2022-06-28 13:11+0200\n" "Last-Translator: \n" "Language: en\n" @@ -26,31 +26,31 @@ msgstr "Passwords don't match" msgid "password_constraint.length" msgstr "Password not long enough" -#: fietsboek/models/track.py:381 +#: fietsboek/models/track.py:392 msgid "tooltip.table.length" msgstr "Length" -#: fietsboek/models/track.py:382 +#: fietsboek/models/track.py:393 msgid "tooltip.table.uphill" msgstr "Uphill" -#: fietsboek/models/track.py:383 +#: fietsboek/models/track.py:394 msgid "tooltip.table.downhill" msgstr "Downhill" -#: fietsboek/models/track.py:384 +#: fietsboek/models/track.py:395 msgid "tooltip.table.moving_time" msgstr "Moving Time" -#: fietsboek/models/track.py:385 +#: fietsboek/models/track.py:396 msgid "tooltip.table.stopped_time" msgstr "Stopped Time" -#: fietsboek/models/track.py:386 +#: fietsboek/models/track.py:397 msgid "tooltip.table.max_speed" msgstr "Max Speed" -#: fietsboek/models/track.py:388 +#: fietsboek/models/track.py:399 msgid "tooltip.table.avg_speed" msgstr "Average Speed" @@ -130,39 +130,39 @@ msgstr "Average Speed" msgid "page.create_account.title" msgstr "Create Account" -#: fietsboek/templates/create_account.jinja2:7 -msgid "page.create_account.email" -msgstr "E-Mail" - #: fietsboek/templates/create_account.jinja2:11 msgid "page.create_account.email_invalid" msgstr "Invalid email address" -#: fietsboek/templates/create_account.jinja2:16 -msgid "page.create_account.name" -msgstr "Name" +#: fietsboek/templates/create_account.jinja2:13 +msgid "page.create_account.email" +msgstr "E-Mail" -#: fietsboek/templates/create_account.jinja2:20 +#: fietsboek/templates/create_account.jinja2:22 msgid "page.create_account.name_invalid" msgstr "Name invalid" -#: fietsboek/templates/create_account.jinja2:25 -msgid "page.create_account.password" -msgstr "Password" +#: fietsboek/templates/create_account.jinja2:24 +msgid "page.create_account.name" +msgstr "Name" -#: fietsboek/templates/create_account.jinja2:29 +#: fietsboek/templates/create_account.jinja2:33 msgid "page.create_account.password_invalid" msgstr "Password not long enough" -#: fietsboek/templates/create_account.jinja2:34 -msgid "page.create_account.repeat_password" -msgstr "Repeat password" +#: fietsboek/templates/create_account.jinja2:35 +msgid "page.create_account.password" +msgstr "Password" -#: fietsboek/templates/create_account.jinja2:38 +#: fietsboek/templates/create_account.jinja2:44 msgid "page.create_account.password_must_match" msgstr "Passwords must match" -#: fietsboek/templates/create_account.jinja2:42 +#: fietsboek/templates/create_account.jinja2:46 +msgid "page.create_account.repeat_password" +msgstr "Repeat password" + +#: fietsboek/templates/create_account.jinja2:52 msgid "page.create_account.create" msgstr "Create" @@ -264,40 +264,44 @@ msgid "page.track.form.visibility.friends" msgstr "Friends only" #: fietsboek/templates/edit_form.jinja2:15 +msgid "page.track.form.visibility.friends_tagged" +msgstr "Friends of all tagged people" + +#: fietsboek/templates/edit_form.jinja2:16 msgid "page.track.form.visibility.logged_in" msgstr "Logged in users" -#: fietsboek/templates/edit_form.jinja2:16 +#: fietsboek/templates/edit_form.jinja2:17 msgid "page.track.form.visibility.public" msgstr "Public" -#: fietsboek/templates/edit_form.jinja2:19 +#: fietsboek/templates/edit_form.jinja2:20 msgid "page.track.form.visibility.info" msgstr "" "Note that tagged people and people with the share link can always view " "the track." -#: fietsboek/templates/edit_form.jinja2:23 +#: fietsboek/templates/edit_form.jinja2:24 msgid "page.track.form.tags" msgstr "Tags" -#: fietsboek/templates/edit_form.jinja2:34 +#: fietsboek/templates/edit_form.jinja2:35 msgid "page.track.form.add_tag" msgstr "Add Tag" -#: fietsboek/templates/edit_form.jinja2:39 +#: fietsboek/templates/edit_form.jinja2:40 msgid "page.track.form.tagged_people" msgstr "Tagged People" -#: fietsboek/templates/edit_form.jinja2:54 +#: fietsboek/templates/edit_form.jinja2:55 msgid "page.track.form.add_friend" msgstr "Search friends" -#: fietsboek/templates/edit_form.jinja2:74 +#: fietsboek/templates/edit_form.jinja2:75 msgid "page.track.form.badges" msgstr "Badges" -#: fietsboek/templates/edit_form.jinja2:85 +#: fietsboek/templates/edit_form.jinja2:86 msgid "page.track.form.description" msgstr "Description" @@ -482,7 +486,6 @@ msgid "flash.invalid_name" msgstr "Invalid name" #: fietsboek/views/account.py:53 -#, fuzzy msgid "flash.invalid_email" msgstr "Invalid email" diff --git a/fietsboek/locale/fietslog.pot b/fietsboek/locale/fietslog.pot index b779e12..8e00bf3 100644 --- a/fietsboek/locale/fietslog.pot +++ b/fietsboek/locale/fietslog.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-07-02 00:40+0200\n" +"POT-Creation-Date: 2022-07-02 17:11+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -25,31 +25,31 @@ msgstr "" msgid "password_constraint.length" msgstr "" -#: fietsboek/models/track.py:381 +#: fietsboek/models/track.py:392 msgid "tooltip.table.length" msgstr "" -#: fietsboek/models/track.py:382 +#: fietsboek/models/track.py:393 msgid "tooltip.table.uphill" msgstr "" -#: fietsboek/models/track.py:383 +#: fietsboek/models/track.py:394 msgid "tooltip.table.downhill" msgstr "" -#: fietsboek/models/track.py:384 +#: fietsboek/models/track.py:395 msgid "tooltip.table.moving_time" msgstr "" -#: fietsboek/models/track.py:385 +#: fietsboek/models/track.py:396 msgid "tooltip.table.stopped_time" msgstr "" -#: fietsboek/models/track.py:386 +#: fietsboek/models/track.py:397 msgid "tooltip.table.max_speed" msgstr "" -#: fietsboek/models/track.py:388 +#: fietsboek/models/track.py:399 msgid "tooltip.table.avg_speed" msgstr "" @@ -129,39 +129,39 @@ msgstr "" msgid "page.create_account.title" msgstr "" -#: fietsboek/templates/create_account.jinja2:7 -msgid "page.create_account.email" -msgstr "" - #: fietsboek/templates/create_account.jinja2:11 msgid "page.create_account.email_invalid" msgstr "" -#: fietsboek/templates/create_account.jinja2:16 -msgid "page.create_account.name" +#: fietsboek/templates/create_account.jinja2:13 +msgid "page.create_account.email" msgstr "" -#: fietsboek/templates/create_account.jinja2:20 +#: fietsboek/templates/create_account.jinja2:22 msgid "page.create_account.name_invalid" msgstr "" -#: fietsboek/templates/create_account.jinja2:25 -msgid "page.create_account.password" +#: fietsboek/templates/create_account.jinja2:24 +msgid "page.create_account.name" msgstr "" -#: fietsboek/templates/create_account.jinja2:29 +#: fietsboek/templates/create_account.jinja2:33 msgid "page.create_account.password_invalid" msgstr "" -#: fietsboek/templates/create_account.jinja2:34 -msgid "page.create_account.repeat_password" +#: fietsboek/templates/create_account.jinja2:35 +msgid "page.create_account.password" msgstr "" -#: fietsboek/templates/create_account.jinja2:38 +#: fietsboek/templates/create_account.jinja2:44 msgid "page.create_account.password_must_match" msgstr "" -#: fietsboek/templates/create_account.jinja2:42 +#: fietsboek/templates/create_account.jinja2:46 +msgid "page.create_account.repeat_password" +msgstr "" + +#: fietsboek/templates/create_account.jinja2:52 msgid "page.create_account.create" msgstr "" @@ -263,38 +263,42 @@ msgid "page.track.form.visibility.friends" msgstr "" #: fietsboek/templates/edit_form.jinja2:15 -msgid "page.track.form.visibility.logged_in" +msgid "page.track.form.visibility.friends_tagged" msgstr "" #: fietsboek/templates/edit_form.jinja2:16 +msgid "page.track.form.visibility.logged_in" +msgstr "" + +#: fietsboek/templates/edit_form.jinja2:17 msgid "page.track.form.visibility.public" msgstr "" -#: fietsboek/templates/edit_form.jinja2:19 +#: fietsboek/templates/edit_form.jinja2:20 msgid "page.track.form.visibility.info" msgstr "" -#: fietsboek/templates/edit_form.jinja2:23 +#: fietsboek/templates/edit_form.jinja2:24 msgid "page.track.form.tags" msgstr "" -#: fietsboek/templates/edit_form.jinja2:34 +#: fietsboek/templates/edit_form.jinja2:35 msgid "page.track.form.add_tag" msgstr "" -#: fietsboek/templates/edit_form.jinja2:39 +#: fietsboek/templates/edit_form.jinja2:40 msgid "page.track.form.tagged_people" msgstr "" -#: fietsboek/templates/edit_form.jinja2:54 +#: fietsboek/templates/edit_form.jinja2:55 msgid "page.track.form.add_friend" msgstr "" -#: fietsboek/templates/edit_form.jinja2:74 +#: fietsboek/templates/edit_form.jinja2:75 msgid "page.track.form.badges" msgstr "" -#: fietsboek/templates/edit_form.jinja2:85 +#: fietsboek/templates/edit_form.jinja2:86 msgid "page.track.form.description" msgstr "" diff --git a/fietsboek/models/track.py b/fietsboek/models/track.py index cc5283a..c8b8dc5 100644 --- a/fietsboek/models/track.py +++ b/fietsboek/models/track.py @@ -15,6 +15,8 @@ import enum import gzip import datetime +from itertools import chain + from sqlalchemy import ( Column, Integer, @@ -65,6 +67,8 @@ class Visibility(enum.Enum): """Only the owner of the track can see it.""" FRIENDS = enum.auto() """Friends of the owner can see the track as well.""" + FRIENDS_TAGGED = enum.auto() + """Friends of the owner or friends of tagged people can see the track.""" LOGGED_IN = enum.auto() """Any logged in user can see the track.""" PUBLIC = enum.auto() @@ -179,6 +183,13 @@ class Track(Base): # logged in user is a friend. if self.visibility == Visibility.FRIENDS: return user in self.owner.get_friends() + if self.visibility == Visibility.FRIENDS_TAGGED: + all_friends = { + friend + for person in chain([self.owner], self.tagged_people) + for friend in person.get_friends() + } + return user in all_friends if user and self.visibility == Visibility.LOGGED_IN: return True return False diff --git a/fietsboek/templates/edit_form.jinja2 b/fietsboek/templates/edit_form.jinja2 index 5851673..6078264 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="FRIENDS_TAGGED"{% if visibility.name == "FRIENDS_TAGGED" %} selected{% endif %}>{{ _("page.track.form.visibility.friends_tagged") }}</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> |