Commit 6c7e7b12 authored by Marcus Lundblad's avatar Marcus Lundblad
Browse files

osmEditDialog: Add e-mail address

Add e-mail address as an editable field.
parent 459a765a
Pipeline #278581 passed with stage
in 15 minutes and 37 seconds
......@@ -85,6 +85,21 @@ var _osmPhoneRewriteFunc = function(text) {
}
};
/* Reformat an e-mail address if it it looks like a mailto: URI
* strip off the leading mailto: protocol string and trailing parameters,
* following a ?
* otherwise return the string unmodified
*/
var _osmEmailRewriteFunc = function(text) {
if (GLib.uri_parse_scheme(text) === 'mailto') {
let afterMailto = text.replace('mailto:', '');
return Soup.uri_decode(afterMailto.split('?')[0]);
} else {
return text;
}
}
/*
* specification of OSM edit fields
* name: the label for the edit field (translatable)
......@@ -136,6 +151,16 @@ const OSM_FIELDS = [
"starting with a + sign. Beware of local privacy " +
"laws, especially for private phone numbers.")
},
{
name: _("E-mail"),
tag: 'email',
type: EditFieldType.TEXT,
validate: Utils.isValidEmail,
rewriteFunc: this._osmEmailRewriteFunc,
validateError: _("This is not a valid e-mail address. Make sure to not include the mailto: protocol prefix."),
hint: _("Contact e-mail address for inquiries." +
"Add only email addresses that are intended to be publicly used.")
},
{
name: _("Wikipedia"),
tag: 'wikipedia',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment