Hotfixes trail visibility

This commit is contained in:
Christian Beutel
2025-06-21 11:52:28 +02:00
parent 0c7718cc24
commit b5a3864f04
3 changed files with 25 additions and 8 deletions

View File

@@ -231,6 +231,23 @@
clearAfterSelect={false} clearAfterSelect={false}
label={$_("author")} label={$_("author")}
></ActorSearch> ></ActorSearch>
<hr class="my-4 border-separator" />
<p class="text-sm font-medium">{$_("visibilty-status")}</p>
<div class="flex items-center mt-2 mb-4">
<input
id="private-checkbox"
type="checkbox"
checked={filter.private}
class="w-4 h-4 bg-input-background accent-primary border-input-border focus:ring-input-ring focus:ring-2"
onchange={setPrivateFilter}
/>
<label for="private-checkbox" class="ms-2 text-sm"
>{$_("private")}</label
>
</div>
<div class="flex items-center my-4"> <div class="flex items-center my-4">
<input <input
id="public-checkbox" id="public-checkbox"

View File

@@ -347,7 +347,7 @@
"use-roads": "Use Roads", "use-roads": "Use Roads",
"username": "Username", "username": "Username",
"view": "View", "view": "View",
"visibilty-status": "", "visibilty-status": "Visibility status",
"walking-speed": "", "walking-speed": "",
"waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}",
"welcome_to": "Welcome to", "welcome_to": "Welcome to",

View File

@@ -533,21 +533,21 @@ function buildFilterText(user: AuthRecord, filter: TrailFilter, includeGeo: bool
if (showPublic === true) { if (showPublic === true) {
filterText += "(public = TRUE"; filterText += "(public = TRUE";
if (showPrivate === true && (!filter.author?.length || filter.author == user?.id)) { if (showPrivate === true && (!filter.author?.length || filter.author == user?.actor)) {
filterText += ` OR author = ${user?.id}`; filterText += ` OR author = ${user?.actor}`;
} }
filterText += ")"; filterText += ")";
} }
else if (!filter.author?.length || filter.author == user?.id) { else if (!filter.author?.length || filter.author == user?.actor) {
filterText += "public = FALSE"; filterText += "public = FALSE";
filterText += ` AND author = ${user?.id}`; filterText += ` AND author = ${user?.actor}`;
} }
if (filter.shared !== undefined) { if (filter.shared !== undefined) {
if (filter.shared === true) { if (filter.shared === true) {
filterText += ` OR shares = ${user?.id}` filterText += ` OR shares = ${user?.actor}`
} else { } else {
filterText += ` AND NOT shares = ${user?.id}` filterText += ` AND NOT shares = ${user?.actor}`
} }
} }