Prevent 'merged as sadface'

Fixes an assumption that current_revision will always be populated in
the change object. Now, the 'Merged as $SHA' text will only appear if
the change status is 'Merged' AND the current_revision SHA exists.

Bug: Issue 5337
Change-Id: Iacde8b340d32d26d27a7ed9601d9fe679fba2df9
This commit is contained in:
Kasper Nilsson
2017-01-25 14:21:44 -08:00
parent 521c604e39
commit ce843969cd
2 changed files with 8 additions and 6 deletions

View File

@@ -255,12 +255,14 @@ limitations under the License.
<a href$="[[_computeChangePermalink(_change._number)]]">[[_change._number]]</a><!--
--><template is="dom-if" if="[[_changeStatus]]">
([[_changeStatus]]<!--
--><template is="dom-if" if="[[_computeShowCommitInfo(_changeStatus)]]">
--><template
is="dom-if"
if="[[_computeShowCommitInfo(_changeStatus, _change.current_revision)]]">
as
<gr-commit-info
change="[[_change]]"
commit-info="[[_computeMergedCommitInfo(_change.current_revision, _change.revisions)]]"
server-config="[[serverConfig]]"></gr-commit-info><!--
change="[[_change]]"
commit-info="[[_computeMergedCommitInfo(_change.current_revision, _change.revisions)]]"
server-config="[[serverConfig]]"></gr-commit-info><!--
--></template><!--
-->)<!--
--></template><!--

View File

@@ -563,8 +563,8 @@
return statusString || '';
},
_computeShowCommitInfo: function(changeStatus) {
return changeStatus === 'Merged';
_computeShowCommitInfo: function(changeStatus, current_revision) {
return changeStatus === 'Merged' && current_revision;
},
_computeMergedCommitInfo: function(current_revision, revisions) {