Don't clean description/note/fixme values (closes #2659)

This commit is contained in:
Bryan Housel
2015-05-26 11:18:09 -04:00
parent 51dfbb18cf
commit 6e27b55061
+11 -7
View File
@@ -133,16 +133,20 @@ iD.ui.EntityEditor = function(context) {
}
function clean(o) {
function isOpeningHours(k) {
return _.any(['opening_hours', 'service_times', 'collection_times',
'operating_times', 'smoking_hours', 'happy_hours'], function(s) {
return k.indexOf(s) !== -1;
});
}
function cleanVal(k, v) {
function keepSpaces(k) {
var whitelist = ['opening_hours', 'service_times', 'collection_times',
'operating_times', 'smoking_hours', 'happy_hours'];
return _.any(whitelist, function(s) { return k.indexOf(s) !== -1; });
}
var blacklist = ['description', 'note', 'fixme'];
if (_.any(blacklist, function(s) { return k.indexOf(s) !== -1; })) return v;
var cleaned = v.split(';')
.map(function(s) { return s.trim(); })
.join(isOpeningHours(k) ? '; ' : ';');
.join(keepSpaces(k) ? '; ' : ';');
// The code below is not intended to validate websites and emails.
// It is only intended to prevent obvious copy-paste errors. (#2323)