Change screen: Show abbreviated commit sha1 in patch set dropdown

Add the sha hash of each patchset in dropdown menu as it was in the old
UI.

Bug: Issue 8513
Change-Id: I9e2f63ff083717ddc096b95e9a0927f5d0446385
This commit is contained in:
Dhruv Srivastava
2019-10-07 14:47:50 +02:00
committed by David Ostrovsky
parent 2067997ce5
commit bb40298008
4 changed files with 61 additions and 47 deletions

View File

@@ -136,6 +136,7 @@ limitations under the License.
* * num {number} The number identifying the patch set
* * desc {!string} Optional patch set description
* * wip {boolean} If true, this patch set was never subject to review.
* * sha {string} hash of the commit
*
* The wip property is determined by the change's current work_in_progress
* property and its log of change messages.
@@ -148,14 +149,18 @@ limitations under the License.
if (!change) { return []; }
let patchNums = [];
if (change.revisions && Object.keys(change.revisions).length) {
const revisions = Object.keys(change.revisions).map(sha => {
return Object.assign({sha}, change.revisions[sha]);
});
patchNums =
Gerrit.PatchSetBehavior.sortRevisions(Object.values(change.revisions))
Gerrit.PatchSetBehavior.sortRevisions(revisions)
.map(e => {
// TODO(kaspern): Mark which patchset an edit was made on, if an
// edit exists -- perhaps with a temporary description.
return {
num: e._number,
desc: e.description,
sha: e.sha,
};
});
}