Skip to content

Commit

Permalink
Enable pinning based on logged-in status, not project.edit_access
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Nov 25, 2024
1 parent 984e4ea commit 32cc3ff
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/lib/components/projects/ProjectPin.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<script lang="ts" context="module">
import { writable, type Writable } from "svelte/store";
import { invalidate } from "$app/navigation";
import { canonicalUrl } from "$lib/api/projects";
import type { Project } from "$lib/api/types";
import { getCsrfToken } from "$lib/utils/api";
import { writable, type Writable } from "svelte/store";
export const pinned: Writable<Project[]> = writable([]);
Expand All @@ -19,12 +15,20 @@
</script>

<script lang="ts">
import { invalidate } from "$app/navigation";
import { canonicalUrl } from "$lib/api/projects";
import { getCsrfToken } from "$lib/utils/api";
import { getCurrentUser } from "$lib/utils/permissions";
import Pin from "@/lib/components/common/Pin.svelte";
import { pinProject } from "$lib/api/projects";
export let project: Project;
export let size = 1;
const me = getCurrentUser();
async function toggle(e) {
e.preventDefault();
const csrf_token = getCsrfToken();
Expand Down Expand Up @@ -55,9 +59,4 @@
}
</script>

<Pin
active={project.pinned}
{size}
disabled={!project.edit_access}
on:click={toggle}
/>
<Pin active={project.pinned} {size} disabled={!$me} on:click={toggle} />

0 comments on commit 32cc3ff

Please sign in to comment.