v4: a playlist's editor has a URL, as a dump's has — it opened over the playlist's header as a state of the page, which a reload or a shared link lost, while a dump's editor is /@name/dumps/<slug>/edit. It is now /@name/playlists/<slug>/edit: Edit goes there, and Cancel or Save come back to the page in its place. Both paths render PlaylistDetail at the same place, so the playlist stays loaded, and a new slug keeps the view. Anyone who may not edit it gets the page, a guest the sign-in first. playlistPath takes the view, and parsePagePath reads it, so its link has no preview, as a dump editor's has none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,12 +30,12 @@ export function isSelfHost(host: string): boolean {
|
||||
|
||||
/**
|
||||
* Checks whether `url` links to one of this site's own dump, user or playlist
|
||||
* pages, by `parsePagePath`; a dump's editor doesn't count. Matched on the
|
||||
* pages, by `parsePagePath`; an editor doesn't count. Matched on the
|
||||
* host as well as the path: `/@bob` on some other site is someone else's
|
||||
* page, not ours.
|
||||
*/
|
||||
export function isSelfUrl(url: URL): boolean {
|
||||
if (!isSelfHost(url.host)) return false;
|
||||
const page = parsePagePath(url.pathname);
|
||||
return !!page && !(page.kind === "dump" && page.edit);
|
||||
return !!page && !(page.kind !== "user" && page.edit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user