M3 wiki-links: [[links]] + backlinks
- Migration 0009: note_links (source_id, target_norm). Parse [[...]] from body on
create/update and rewrite the source's links. GET /api/notes/titles (owner
{id,title} index for client-side resolution); GET /api/notes/<id>/backlinks.
- Frontend: titles store; LinkedText renders [[Title]] styled on cards; editor
shows Links (outgoing, resolve/create-on-click) + Linked-from (backlinks),
clicking navigates the editor to the target note (board + search).
- notes store: fetchOne, createTitled. DB-free link-parser tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
This commit is contained in:
+17
-1
@@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
from thoughtsync.app import create_app
|
||||
from thoughtsync.models.note import NOTE_COLORS, Note
|
||||
from thoughtsync.notes import is_empty_note, normalize_color
|
||||
from thoughtsync.notes import is_empty_note, normalize_color, parse_link_titles
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -74,3 +74,19 @@ async def test_reorder_requires_auth(app):
|
||||
client = app.test_client()
|
||||
resp = await client.post("/api/notes/reorder", json={"ids": []})
|
||||
assert resp.status_code == 401
|
||||
|
||||
|
||||
def test_parse_link_titles():
|
||||
titles = parse_link_titles("see [[Alpha]] and [[ beta ]] and [[Alpha]] again")
|
||||
assert titles == ["alpha", "beta"]
|
||||
|
||||
|
||||
def test_parse_link_titles_empty():
|
||||
assert parse_link_titles(None) == []
|
||||
assert parse_link_titles("no links here") == []
|
||||
|
||||
|
||||
async def test_titles_requires_auth(app):
|
||||
client = app.test_client()
|
||||
resp = await client.get("/api/notes/titles")
|
||||
assert resp.status_code == 401
|
||||
|
||||
Reference in New Issue
Block a user