Set topic by Change-Id
When setting a topic, GR-CHANGE-METADATA would call the set-topic API endpoint identifying the change using the following format: <project>~<branch>~<Change-Id> When the project or branch contained characters that needed to be URI- encoded, the endpoint would fail to identify the change, resulting in a 404. This API behavior is encoded in Issue 4746. The workaround in this change is to instead identify the change by the shorter Change-Id format (`Ie<hex ...>`), which needs no additional encoding. Bug: Issue 4555 Change-Id: I00181387bc2a85dfea90b9db46fb017749963579
This commit is contained in:
@@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
_handleTopicChanged: function(e, topic) {
|
_handleTopicChanged: function(e, topic) {
|
||||||
if (!topic.length) { topic = null; }
|
if (!topic.length) { topic = null; }
|
||||||
this.$.restAPI.setChangeTopic(this.change.id, topic);
|
this.$.restAPI.setChangeTopic(this.change.change_id, topic);
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeTopicReadOnly: function(mutable, change) {
|
_computeTopicReadOnly: function(mutable, change) {
|
||||||
|
@@ -85,6 +85,8 @@ limitations under the License.
|
|||||||
sandbox.stub(element, '_computeValueTooltip').returns('');
|
sandbox.stub(element, '_computeValueTooltip').returns('');
|
||||||
sandbox.stub(element, '_computeTopicReadOnly').returns(true);
|
sandbox.stub(element, '_computeTopicReadOnly').returns(true);
|
||||||
element.change = {
|
element.change = {
|
||||||
|
change_id: 'the id',
|
||||||
|
topic: 'the topic',
|
||||||
status: 'NEW',
|
status: 'NEW',
|
||||||
submit_type: 'CHERRY_PICK',
|
submit_type: 'CHERRY_PICK',
|
||||||
labels: {
|
labels: {
|
||||||
@@ -145,6 +147,13 @@ limitations under the License.
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('changing topic calls setChangeTopic', function() {
|
||||||
|
var topicStub = sandbox.stub(element.$.restAPI, 'setChangeTopic',
|
||||||
|
function() {});
|
||||||
|
element._handleTopicChanged({}, 'the new topic');
|
||||||
|
assert.isTrue(topicStub.calledWith('the id', 'the new topic'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user