@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix minor inline comment header button behaviors

Summary:
Fixes T12806. Ref T12733.

- Don't count synthetic (lint) comments as anything.
- When you begin writing an inline then cancel it, don't count it as anything.
- When we would show "0 / X", just show "X".

Test Plan:
- Viewed a diff with synthetic comments, no button.
- Wrote, then cancelled an inline. No "X comments".
- Clicked / unlicked "Done", saw "X" -> "1 / X".

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12806, T12733

Differential Revision: https://secure.phabricator.com/D18103

+42 -12
+6 -5
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
··· 107 107 break; 108 108 } 109 109 110 + $is_synthetic = false; 111 + if ($inline->getSyntheticAuthor()) { 112 + $is_synthetic = true; 113 + } 114 + 110 115 $metadata = array( 111 116 'id' => $inline->getID(), 112 117 'phid' => $inline->getPHID(), ··· 120 125 'isDraft' => $inline->isDraft(), 121 126 'isFixed' => $is_fixed, 122 127 'isGhost' => $inline->getIsGhost(), 128 + 'isSynthetic' => $is_synthetic, 123 129 ); 124 130 125 131 $sigil = 'differential-inline-comment'; ··· 135 141 $handles = $this->handles; 136 142 137 143 $links = array(); 138 - 139 - $is_synthetic = false; 140 - if ($inline->getSyntheticAuthor()) { 141 - $is_synthetic = true; 142 - } 143 144 144 145 $draft_text = null; 145 146 if (!$is_synthetic) {
+30 -7
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 1352 1352 continue; 1353 1353 } 1354 1354 1355 + if (inline.isSynthetic()) { 1356 + continue; 1357 + } 1358 + 1355 1359 if (inline.isEditing()) { 1356 1360 unsaved.push(inline); 1361 + } else if (!inline.getID()) { 1362 + // These are new comments which have been cancelled, and do not 1363 + // count as anything. 1364 + continue; 1357 1365 } else if (inline.isDraft()) { 1358 1366 unsubmitted.push(inline); 1359 1367 } else if (!inline.isDone()) { ··· 1395 1403 } 1396 1404 1397 1405 if (done.length || undone.length) { 1398 - done_button.setText([ 1399 - done.length, 1400 - ' / ', 1401 - (done.length + undone.length), 1402 - ' ', 1403 - pht('Comments') 1404 - ]); 1406 + // If you haven't marked any comments as "Done", we just show text 1407 + // like "3 Comments". If you've marked at least one done, we show 1408 + // "1 / 3 Comments". 1409 + 1410 + var done_text; 1411 + if (done.length) { 1412 + done_text = [ 1413 + done.length, 1414 + ' / ', 1415 + (done.length + undone.length), 1416 + ' ', 1417 + pht('Comments') 1418 + ]; 1419 + } else { 1420 + done_text = [ 1421 + undone.length, 1422 + ' ', 1423 + pht('Comments') 1424 + ]; 1425 + } 1426 + 1427 + done_button.setText(done_text); 1405 1428 1406 1429 JX.DOM.show(done_button.getNode()); 1407 1430
+6
webroot/rsrc/js/application/diff/DiffInline.js
··· 34 34 _isFixed: null, 35 35 _isEditing: false, 36 36 _isNew: false, 37 + _isSynthetic: false, 37 38 38 39 bindToRow: function(row) { 39 40 this._row = row; ··· 71 72 this._isDraft = data.isDraft; 72 73 this._isFixed = data.isFixed; 73 74 this._isGhost = data.isGhost; 75 + this._isSynthetic = data.isSynthetic; 74 76 75 77 this._changesetID = data.changesetID; 76 78 this._isNew = false; ··· 95 97 96 98 isDeleted: function() { 97 99 return this._isDeleted; 100 + }, 101 + 102 + isSynthetic: function() { 103 + return this._isSynthetic; 98 104 }, 99 105 100 106 bindToRange: function(data) {