* Renders a readable plain-text document from a fully-fetched request and its * comments. Includes summary, description, reporter, status, and comment thread.
(request: JsmRequest, comments: JsmComment[])
| 226 | * comments. Includes summary, description, reporter, status, and comment thread. |
| 227 | */ |
| 228 | function buildContent(request: JsmRequest, comments: JsmComment[]): string { |
| 229 | const parts: string[] = [] |
| 230 | |
| 231 | const summary = getFieldText(request, 'summary') |
| 232 | if (summary) parts.push(summary) |
| 233 | |
| 234 | const description = getFieldText(request, 'description') |
| 235 | if (description) parts.push(description) |
| 236 | |
| 237 | const status = request.currentStatus?.status |
| 238 | if (status) parts.push(`Status: ${status}`) |
| 239 | |
| 240 | const reporter = request.reporter?.displayName |
| 241 | if (reporter) parts.push(`Reporter: ${reporter}`) |
| 242 | |
| 243 | if (comments.length > 0) { |
| 244 | parts.push('Comments:') |
| 245 | for (const comment of comments) { |
| 246 | const body = (comment.body ?? '').trim() |
| 247 | if (!body) continue |
| 248 | const author = comment.author?.displayName |
| 249 | parts.push(author ? `${author}: ${body}` : body) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | return parts.join('\n\n').trim() |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Resolves and caches the Jira cloud ID for a domain across a sync run. |
no test coverage detected