Commit b25cce17 authored by Stephane Glondu's avatar Stephane Glondu

Change logic in setting contact info

We consider the contact empty if it is set to the default value.
parent 5df632f1
......@@ -258,3 +258,5 @@ let write_file ?uuid x lines =
Lwt_list.iter_s (write_line oc) lines
)
)
let default_contact = "Name <user@example.org>"
......@@ -105,3 +105,5 @@ val is_email : string -> bool
val read_file : ?uuid:uuid -> string -> string list option Lwt.t
val write_file : ?uuid:uuid -> string -> string list -> unit Lwt.t
val default_contact : string
......@@ -384,7 +384,7 @@ let create_new_election owner cred auth =
e_cred_authority;
e_trustees = None;
e_languages = Some ["en"; "fr"];
e_contact = Some "Name <user@example.org>";
e_contact = None;
} in
let question = {
q_answers = [| "Answer 1"; "Answer 2"; "Answer 3" |];
......@@ -531,7 +531,11 @@ let () =
Any.register ~service:election_setup_contact
(fun uuid contact ->
with_setup_election uuid (fun se ->
let contact = if contact = "" then None else Some contact in
let contact =
if contact = "" || contact = default_contact then
None
else Some contact
in
se.se_metadata <- {
se.se_metadata with
e_contact = contact
......
......@@ -404,7 +404,7 @@ let election_setup uuid se () =
let value =
match se.se_metadata.e_contact with
| Some x -> x
| None -> ""
| None -> default_contact
in
string_input ~name:contact ~input_type:`Text ~value ();
];
......
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