longform: fix note URLs not opening from nevent references
Previously, clicking nevent links pointing to longform notes (kind 30023) showed "Can't display note" error because .longform was listed as an unsupported kind in LoadableNostrEventView. This fix adds .longform to the supported kinds alongside .text and .highlight, routing them to ThreadModel for proper display. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes: https://github.com/damus-io/damus/pull/3487 Closes: https://github.com/damus-io/damus/issues/3003 Closes: https://github.com/damus-io/damus/issues/3485 Changelog-Fixed: Longform article links now open correctly when shared as nevent URLs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: alltheseas <alltheseas@users.noreply.github.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
078042546b
commit
b105dadd14
@@ -62,7 +62,7 @@ class LoadableNostrEventViewModel: ObservableObject {
|
|||||||
guard let ev = await self.loadEvent(noteId: note_id) else { return .not_found }
|
guard let ev = await self.loadEvent(noteId: note_id) else { return .not_found }
|
||||||
guard let known_kind = ev.known_kind else { return .unknown_or_unsupported_kind }
|
guard let known_kind = ev.known_kind else { return .unknown_or_unsupported_kind }
|
||||||
switch known_kind {
|
switch known_kind {
|
||||||
case .text, .highlight:
|
case .text, .highlight, .longform:
|
||||||
return .loaded(route: Route.Thread(thread: ThreadModel(event: ev, damus_state: damus_state)))
|
return .loaded(route: Route.Thread(thread: ThreadModel(event: ev, damus_state: damus_state)))
|
||||||
case .dm:
|
case .dm:
|
||||||
let dm_model = damus_state.dms.lookup_or_create(ev.pubkey)
|
let dm_model = damus_state.dms.lookup_or_create(ev.pubkey)
|
||||||
@@ -74,7 +74,7 @@ class LoadableNostrEventViewModel: ObservableObject {
|
|||||||
case .zap, .zap_request:
|
case .zap, .zap_request:
|
||||||
guard let zap = await get_zap(from: ev, state: damus_state) else { return .not_found }
|
guard let zap = await get_zap(from: ev, state: damus_state) else { return .not_found }
|
||||||
return .loaded(route: Route.Zaps(target: zap.target))
|
return .loaded(route: Route.Zaps(target: zap.target))
|
||||||
case .contacts, .metadata, .delete, .boost, .chat, .mute_list, .list_deprecated, .draft, .longform, .nwc_request, .nwc_response, .http_auth, .status, .relay_list, .follow_list, .interest_list, .contact_card, .live, .live_chat:
|
case .contacts, .metadata, .delete, .boost, .chat, .mute_list, .list_deprecated, .draft, .nwc_request, .nwc_response, .http_auth, .status, .relay_list, .follow_list, .interest_list, .contact_card, .live, .live_chat:
|
||||||
return .unknown_or_unsupported_kind
|
return .unknown_or_unsupported_kind
|
||||||
}
|
}
|
||||||
case .naddr(let naddr):
|
case .naddr(let naddr):
|
||||||
|
|||||||
Reference in New Issue
Block a user