Properly annotate parent comments with the patch number associated

Comments/drafts on the base file (PARENT) are actually part of the
patchset they are created under. PARENT is not a valid patch set
to save them under. Account for this when saving/creating new ones.

Change-Id: I151d83d03192efab50152ce5018e26b737e08e19
This commit is contained in:
Andrew Bonventre 2016-01-11 12:24:16 -05:00
parent 1141b4eef0
commit d199e61729
2 changed files with 13 additions and 3 deletions

View File

@ -397,7 +397,7 @@ limitations under the License.
this._handleCommentThreadDiscard.bind(this));
threadEl.setAttribute('data-index', index);
threadEl.changeNum = this.changeNum;
threadEl.patchNum = this.patchNum;
threadEl.patchNum = thread.patchNum || this.patchNum;
threadEl.path = this.path;
threadEl.comments = thread.comments;
threadEl.showActions = this.canComment;

View File

@ -406,6 +406,12 @@ limitations under the License.
path: this.path,
}]
};
if (diffEl == this.$.leftDiff &&
this.patchRange.basePatchNum == 'PARENT') {
comment.comments[0].side = 'PARENT';
comment.patchNum = this.patchRange.patchNum;
}
if (content[insertIndex] &&
content[insertIndex].type == 'FILLER') {
content[insertIndex] = comment;
@ -642,10 +648,14 @@ limitations under the License.
var leftComments = this._groupedBaseComments[ctx.left.lineNum];
var rightComments = this._groupedComments[ctx.right.lineNum];
if (leftComments) {
leftSide.push({
var thread = {
type: 'COMMENT_THREAD',
comments: leftComments,
});
};
if (this.patchRange.basePatchNum == 'PARENT') {
thread.patchNum = this.patchRange.patchNum;
}
leftSide.push(thread);
}
if (rightComments) {
rightSide.push({