azdo-cli 0.5.0-017-pr-comments-threads.250 → 0.5.0-017-pr-comments-threads.254

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +10 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2573,7 +2573,7 @@ function threadStatusLabel(status) {
2573
2573
  return isThreadResolved(status) ? "resolved" : status;
2574
2574
  }
2575
2575
  function formatThreads(prId, title, threads) {
2576
- const lines = [`Active comments for pull request #${prId}: ${title}`];
2576
+ const lines = [`Comment threads for pull request #${prId}: ${title}`];
2577
2577
  for (const thread of threads) {
2578
2578
  lines.push("", `Thread #${thread.id} [${threadStatusLabel(thread.status)}] ${thread.threadContext ?? "(general)"}`);
2579
2579
  for (const comment of thread.comments) {
@@ -2586,16 +2586,7 @@ async function resolvePrCommandContext(options, resolveOpts = {}) {
2586
2586
  const requireBranch = resolveOpts.requireBranch ?? true;
2587
2587
  const context = resolveContext(options);
2588
2588
  const repo = detectRepoName();
2589
- let branch;
2590
- if (requireBranch) {
2591
- branch = getCurrentBranch();
2592
- } else {
2593
- try {
2594
- branch = getCurrentBranch();
2595
- } catch {
2596
- branch = null;
2597
- }
2598
- }
2589
+ const branch = requireBranch ? getCurrentBranch() : null;
2599
2590
  const credential = await requirePat(context.org);
2600
2591
  return {
2601
2592
  context,
@@ -2751,8 +2742,13 @@ function createPrCommentsCommand() {
2751
2742
  return;
2752
2743
  }
2753
2744
  if (threads.length === 0) {
2754
- process.stdout.write(`Pull request #${pullRequest.id} has no active comments.
2745
+ if (options.hideResolved && allThreads.length > 0) {
2746
+ process.stdout.write(`Pull request #${pullRequest.id} has no unresolved comment threads (${allThreads.length} resolved thread${allThreads.length === 1 ? "" : "s"} hidden by --hide-resolved).
2747
+ `);
2748
+ } else {
2749
+ process.stdout.write(`Pull request #${pullRequest.id} has no comment threads.
2755
2750
  `);
2751
+ }
2756
2752
  return;
2757
2753
  }
2758
2754
  process.stdout.write(`${formatThreads(pullRequest.id, pullRequest.title, threads)}
@@ -2828,7 +2824,7 @@ async function runThreadStateChange(threadIdRaw, options, direction) {
2828
2824
  const noopResult = {
2829
2825
  pullRequestId: target.pullRequest.id,
2830
2826
  threadId: target.threadId,
2831
- status: targetStatus,
2827
+ status: thread.status,
2832
2828
  noop: true
2833
2829
  };
2834
2830
  if (options.json) {
@@ -2836,7 +2832,7 @@ async function runThreadStateChange(threadIdRaw, options, direction) {
2836
2832
  `);
2837
2833
  return;
2838
2834
  }
2839
- process.stdout.write(`Thread #${target.threadId} is already ${humanLabel} on pull request #${target.pullRequest.id}.
2835
+ process.stdout.write(`Thread #${target.threadId} is already ${humanLabel} on pull request #${target.pullRequest.id} (current status: ${thread.status}).
2840
2836
  `);
2841
2837
  return;
2842
2838
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azdo-cli",
3
- "version": "0.5.0-017-pr-comments-threads.250",
3
+ "version": "0.5.0-017-pr-comments-threads.254",
4
4
  "description": "Azure DevOps CLI tool",
5
5
  "type": "module",
6
6
  "bin": {