Use 'Commit message' and 'Merge list' in comment-list

This brings the comment list (both in the messages at the bottom
and in the reply modal dialog) into line with the file list,
emails, and other places the file names are displayed.

Change-Id: Id0ef2e3bafb63070d2284e4b70613ac92300d14d
This commit is contained in:
Aaron Gable
2017-05-08 11:42:08 -07:00
parent b60019026b
commit b82043a3a5
3 changed files with 24 additions and 1 deletions

View File

@@ -53,7 +53,9 @@ limitations under the License.
</style>
<template is="dom-repeat" items="[[_computeFilesFromComments(comments)]]" as="file">
<div class="file">
<a href$="[[_computeFileDiffURL(file, changeNum, patchNum)]]">[[file]]</a>:
<a href$="[[_computeFileDiffURL(file, changeNum, patchNum)]]">
[[_computeFileDisplayName(file)]]
</a>:
</div>
<template is="dom-repeat"
items="[[_computeCommentsForFile(comments, file)]]" as="comment">

View File

@@ -14,6 +14,9 @@
(function() {
'use strict';
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
var MERGE_LIST_PATH = '/MERGE_LIST';
Polymer({
is: 'gr-comment-list',
@@ -39,6 +42,15 @@
'/' + patchNum + '/' + file;
},
_computeFileDisplayName: function(path) {
if (path === COMMIT_MESSAGE_PATH) {
return 'Commit message';
} else if (path === MERGE_LIST_PATH) {
return 'Merge list';
}
return path;
},
_isOnParent: function(comment) {
return comment.side === 'PARENT';
},

View File

@@ -65,6 +65,15 @@ limitations under the License.
assert.equal(actual, expected);
});
test('_computeFileDisplayName', function() {
assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
'Commit message');
assert.equal(element._computeFileDisplayName('/MERGE_LIST'),
'Merge list');
assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
'/foo/bar/baz');
});
test('_computeDiffLineURL', function() {
var comment = {line: 123, side: 'REVISION', patch_set: 10};
var expected = '/c/<change>/<patch>/<file>#123';