Merge "Patch optional commit field on CommitInfo response if missing"
This commit is contained in:
@@ -689,8 +689,8 @@
|
|||||||
if (!change.reviewer_updates) {
|
if (!change.reviewer_updates) {
|
||||||
change.reviewer_updates = null;
|
change.reviewer_updates = null;
|
||||||
}
|
}
|
||||||
var currentRevision =
|
var latestRevisionSha = this._getLatestRevisionSHA(change);
|
||||||
change.revisions[this._getLatestRevisionSHA(change)];
|
var currentRevision = change.revisions[latestRevisionSha];
|
||||||
if (currentRevision.commit && currentRevision.commit.message) {
|
if (currentRevision.commit && currentRevision.commit.message) {
|
||||||
this._latestCommitMessage = currentRevision.commit.message;
|
this._latestCommitMessage = currentRevision.commit.message;
|
||||||
} else {
|
} else {
|
||||||
@@ -700,6 +700,10 @@
|
|||||||
this._change = change;
|
this._change = change;
|
||||||
if (!this._patchRange || !this._patchRange.patchNum ||
|
if (!this._patchRange || !this._patchRange.patchNum ||
|
||||||
this._patchRange.patchNum === currentRevision._number) {
|
this._patchRange.patchNum === currentRevision._number) {
|
||||||
|
// CommitInfo.commit is optional, and may need patching.
|
||||||
|
if (!currentRevision.commit.commit) {
|
||||||
|
currentRevision.commit.commit = latestRevisionSha;
|
||||||
|
}
|
||||||
this._commitInfo = currentRevision.commit;
|
this._commitInfo = currentRevision.commit;
|
||||||
this._currentRevisionActions = currentRevision.actions;
|
this._currentRevisionActions = currentRevision.actions;
|
||||||
// TODO: Fetch and process files.
|
// TODO: Fetch and process files.
|
||||||
|
@@ -498,6 +498,23 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('commit sha is populated from getChangeDetail', function(done) {
|
||||||
|
sandbox.stub(element, '_changeChanged');
|
||||||
|
sandbox.stub(element.$.restAPI, 'getChangeDetail', function() {
|
||||||
|
return Promise.resolve({
|
||||||
|
id: '123456789',
|
||||||
|
labels: {},
|
||||||
|
current_revision: 'foo',
|
||||||
|
revisions: {foo: {commit: {}}},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
element._getChangeDetail().then(function() {
|
||||||
|
assert.equal('foo', element._commitInfo.commit);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('reply dialog focus can be controlled', function() {
|
test('reply dialog focus can be controlled', function() {
|
||||||
var FocusTarget = element.$.replyDialog.FocusTarget;
|
var FocusTarget = element.$.replyDialog.FocusTarget;
|
||||||
var openSpy = sandbox.spy(element, '_openReplyDialog');
|
var openSpy = sandbox.spy(element, '_openReplyDialog');
|
||||||
|
Reference in New Issue
Block a user