Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/lib/search-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export async function runSearch(
function buildSearchResultUrl(
workspaceId: number,
result: {
id: string
type: string
threadId?: string | null
channelId?: string | null
Expand All @@ -233,10 +234,17 @@ function buildSearchResultUrl(
commentId: result.commentId,
})
}
if (result.type === 'conversation') {
return getFullCommsURL({ workspaceId, conversationId: result.id })
}
if (result.type === 'message' && result.conversationId) {
return getFullCommsURL({ workspaceId, conversationId: result.conversationId })
return getFullCommsURL({
workspaceId,
conversationId: result.conversationId,
messageId: result.id,
})
}
return `https://comms.todoist.com/a/${workspaceId}`
return `https://comms.todoist.com/${workspaceId}`
}

type SearchOutputOptions = Pick<SharedSearchOptions, 'all' | 'json' | 'ndjson' | 'full'>
Expand Down
Loading