Omit changeset comment if empty (fixes #1360)

This commit is contained in:
John Firebaugh
2013-04-22 12:05:46 -07:00
parent 0dc7159b82
commit 765fedef15
2 changed files with 20 additions and 5 deletions
+14 -5
View File
@@ -211,16 +211,25 @@ iD.Connection = function() {
};
};
connection.changesetTags = function(comment, imagery_used) {
var tags = {
imagery_used: imagery_used.join(';'),
created_by: 'iD ' + iD.version
};
if (comment) {
tags.comment = comment;
}
return tags;
};
connection.putChangeset = function(changes, comment, imagery_used, callback) {
oauth.xhr({
method: 'PUT',
path: '/api/0.6/changeset/create',
options: { header: { 'Content-Type': 'text/xml' } },
content: JXON.stringify(connection.changesetJXON({
imagery_used: imagery_used.join(';'),
comment: comment,
created_by: 'iD ' + iD.version
}))
content: JXON.stringify(connection.changesetJXON(connection.changesetTags(comment, imagery_used)))
}, function(err, changeset_id) {
if (err) return callback(err);
oauth.xhr({
+6
View File
@@ -190,4 +190,10 @@ describe('iD.Connection', function () {
]);
});
});
describe('#changesetTags', function() {
it('omits comment when empty', function() {
expect(c.changesetTags('', [])).not.to.have.property('comment');
})
})
});