Merge "Fix bug where comments were not updated in reply dialog"

This commit is contained in:
Andrew Bonventre
2016-05-31 21:51:10 +00:00
committed by Gerrit Code Review
3 changed files with 8 additions and 9 deletions

View File

@@ -169,7 +169,9 @@
}
}
if (index === -1) {
throw Error('Unable to find draft with id ' + draft.id);
// It may be a draft that hasnt been added to _diffDrafts since it was
// never saved.
return;
}
draft.patch_set = draft.patch_set || this._patchRange.patchNum;

View File

@@ -42,7 +42,7 @@ limitations under the License.
word-wrap: break-word;
}
</style>
<template is="dom-repeat" items="[[_files]]" as="file">
<template is="dom-repeat" items="[[_computeFilesFromComments(comments)]]" as="file">
<div class="file">
<a href$="[[_computeFileDiffURL(file, changeNum, patchNum)]]">[[file]]</a>:
</div>

View File

@@ -21,14 +21,9 @@
changeNum: Number,
comments: Object,
patchNum: Number,
_files: {
type: Array,
computed: '_computeFiles(comments)',
},
},
_computeFiles: function(comments) {
_computeFilesFromComments: function(comments) {
return Object.keys(comments || {}).sort();
},
@@ -46,7 +41,9 @@
},
_computeCommentsForFile: function(comments, file) {
return comments[file];
// Changes are not picked up by the dom-repeat due to the array instance
// identity not changing even when it has elements added/removed from it.
return (comments[file] || []).slice();
},
_computePatchDisplayName: function(comment) {