mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Omit changeset comment if empty (fixes #1360)
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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');
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user