core, web: pin, archive and reorder a note someone shared with you

Schema v12 adds notes.state_at: a recipient's own pin, archive and order are
stamped there instead of on updated_at, which stays the text's time. Push sends
them only to a server advertising `shared_state` (push::Accepts), a view share
included; the first pull at that level starts the feed over once so held copies
drop their owner's pins. The client speaks protocol 7 and lists `shares` and
`shared_state` among the features a server may lack.

The web card and editor offer pin, archive and drag on shared notes; share and
trash stay the owner's, and the board's trash key skips notes you don't own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 17:13:58 -04:00
co-authored by Claude Opus 5.5
parent 63955bbe97
commit 89cd1c76bb
9 changed files with 304 additions and 91 deletions
+7 -4
View File
@@ -124,7 +124,8 @@ const root = ref<HTMLElement | null>(null);
// touch — on a phone this did nothing at all. One code path now covers mouse, touch
// and stylus. See composables/useCardDrag.ts for why the state is shared. ---
// Board order is the owner's; a shared note's place is the recipient's from #5176.
const canDrag = () => !!props.reorderable && !props.note.trashed && own.value;
// A shared note moves on the recipient's board only (#5176), so anyone may drag it.
const canDrag = () => !!props.reorderable && !props.note.trashed;
const dragging = computed(() => draggingId.value === props.note.id);
const dragOver = computed(() => overId.value === props.note.id);
@@ -458,9 +459,10 @@ const tagColors = computed<Record<string, string>>(() => {
<Icon name="grip" />
</button>
<!-- Every action here is the owner's, so a shared note has no action set. -->
<!-- Pin and archive are everyone's own (#5176); share and trash are the owner's.
A note shared with you is never in your Trash, so the trashed set is too. -->
<div
v-if="own"
v-if="own || !note.trashed"
class="note-actions-set hover-reveal pointer-events-none flex items-center gap-0.5 rounded-full bg-white/85 p-0.5 opacity-0 shadow-sm ring-1 ring-black/5 backdrop-blur-sm transition focus-within:pointer-events-auto focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100 dark:bg-neutral-900/85 dark:ring-white/10"
>
<template v-if="note.trashed">
@@ -477,7 +479,7 @@ const tagColors = computed<Record<string, string>>(() => {
<Icon name="trash" />
</button>
</template>
<template v-else-if="own">
<template v-else>
<button
v-if="canShare"
type="button"
@@ -509,6 +511,7 @@ const tagColors = computed<Record<string, string>>(() => {
<Icon name="archive" />
</button>
<button
v-if="own"
type="button"
class="icon-btn"
title="Move to trash"
+3 -1
View File
@@ -865,7 +865,8 @@ function revPreview(rev: NoteRevision): string {
>
<Icon name="history" />
</button>
<template v-if="!isCreate && !liveNote.trashed && own">
<!-- Pin and archive are everyone's own on a shared note (#5176); trash is the owner's. -->
<template v-if="!isCreate && !liveNote.trashed">
<button
type="button"
class="icon-btn"
@@ -884,6 +885,7 @@ function revPreview(rev: NoteRevision): string {
<Icon name="archive" />
</button>
<button
v-if="own"
type="button"
class="icon-btn"
title="Move to trash"
+3 -1
View File
@@ -5,6 +5,7 @@ import { useNotesStore, type Note, type NoteView } from "../stores/notes";
import { useConfigStore } from "../stores/config";
import { useUiStore } from "../stores/ui";
import { facetCount, facetsFromQuery, facetsToQuery } from "../notes/facets";
import { isOwnNote } from "../notes/sharing";
import { useNoteEditor } from "../composables/useNoteEditor";
import AsyncState from "../components/AsyncState.vue";
import EmptyState from "../components/EmptyState.vue";
@@ -127,7 +128,8 @@ function onBoardKey(e: KeyboardEvent) {
if (key === "Enter") {
e.preventDefault();
openEditor(note);
} else if (key === "x" && !inTrash.value) {
} else if (key === "x" && !inTrash.value && isOwnNote(note)) {
// Trash is the owner's; archive and pin below are everyone's own (#5176).
e.preventDefault();
void notes.trash(note.id);
} else if (key === "e" && !inTrash.value) {