Use uri for permalinks, fix Micropub Location header, and drop notes.shorturl #149

Merged
jonny merged 4 commits from 148-permalink-uri into develop 2026-11-01 16:49:49 +01:00
Owner

Closes #148, except the optional newbase60 follow-up, which we decided not to do.

Changes

  • uri for permalinks: adds uri to Like and renames Bookmark::localUri() to uri(), so every postable model uses uri for its absolute permalink here.
  • Micropub Location header: likes returned the liked post's URL, and bookmarks returned an empty header because Bookmark had no uri. Both now return our own page.
  • Like template: uses $like->uri instead of the hard-coded /likes/{id}.
  • notes.shorturl: adds a migration dropping the column.

Dropping notes.shorturl

This permanently deletes data on production. The issue says the column has no non-null values, but that's only true locally. Production has 17 non-null values, on notes 1 to 17 (December 2013 to January 2014).

They are random 4-character codes from the old short domain, and nothing in the app reads them. Those short links already stopped working when the domain went, and the notes themselves aren't affected, so these are fine to lose.

Rolling back restores the column as nullable at the end of the table, but not the values.

database/schema/pgsql-schema.sql still lists shorturl. It's left as is because the last three migrations didn't update the dump either, and the new migration drops the column on a fresh install.

Testing

  • The full test suite (389 tests) and Pint pass.
  • New tests assert the Location header value for a like and a bookmark. The like test fails without the EntryHandler change. The bookmark test is fixed by the rename in 5481956d.
  • The migration was run up, down and up again on the test database.

🤖 Generated with Claude Code

Closes #148, except the optional newbase60 follow-up, which we decided not to do. ## Changes - **`uri` for permalinks:** adds `uri` to `Like` and renames `Bookmark::localUri()` to `uri()`, so every postable model uses `uri` for its absolute permalink here. - **Micropub `Location` header:** likes returned the liked post's URL, and bookmarks returned an empty header because `Bookmark` had no `uri`. Both now return our own page. - **Like template:** uses `$like->uri` instead of the hard-coded `/likes/{id}`. - **`notes.shorturl`:** adds a migration dropping the column. ## Dropping `notes.shorturl` **This permanently deletes data on production.** The issue says the column has no non-null values, but that's only true locally. Production has 17 non-null values, on notes 1 to 17 (December 2013 to January 2014). They are random 4-character codes from the old short domain, and nothing in the app reads them. Those short links already stopped working when the domain went, and the notes themselves aren't affected, so these are fine to lose. Rolling back restores the column as nullable at the end of the table, but not the values. `database/schema/pgsql-schema.sql` still lists `shorturl`. It's left as is because the last three migrations didn't update the dump either, and the new migration drops the column on a fresh install. ## Testing - The full test suite (389 tests) and Pint pass. - New tests assert the `Location` header value for a like and a bookmark. The like test fails without the `EntryHandler` change. The bookmark test is fixed by the rename in `5481956d`. - The migration was run up, down and up again on the test database. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`uri` is the attribute every other postable model uses for its absolute
permalink on this site. Add it to Like, which had none, and rename
Bookmark's `local_uri` to match. `url` stays as the thing being liked or
bookmarked.

Refs #148

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Likes returned `url`, which is the liked post rather than our page. Use
`uri` instead. Bookmarks already asked for `uri`, which didn't exist until
the previous commit, so their Location header was empty.

Neither case had a test, so assert the header value for both.

Refs #148

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #148

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The short domain is gone and nothing reads or writes this column any more.

Refs #148

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonny merged commit cc2ff2b2a2 into develop 2026-11-01 16:49:49 +01:00
jonny deleted branch 148-permalink-uri 2026-11-01 16:49:49 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jonny/jonnybarnes.uk!149
No description provided.