Skip to content

Commit ef1ae30

Browse files
timohubermabiede
andauthored
add hint about email update (#343)
* add hint about email update * externalize contact links and forms * Update pool/app/pool_common/locales/i18n_de.ml Co-authored-by: Marc <marc.biedermann@econ.uzh.ch> --------- Co-authored-by: Timo Huber <timo.huber@econ.uzh.ch> Co-authored-by: Marc <marc.biedermann@econ.uzh.ch>
1 parent a590e50 commit ef1ae30

File tree

6 files changed

+34
-10
lines changed

6 files changed

+34
-10
lines changed

pool/app/pool_common/entity_i18n.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ type hint =
151151
| ContactEnrollmentDoesNotMatchFilter
152152
| ContactEnrollmentRegistrationDisabled
153153
| ContactEnterCellPhoneToken of string
154+
| ContactInformationEmailHint
154155
| ContactLanguage
155156
| ContactNoCellPhone
156157
| ContactOnWaitingList

pool/app/pool_common/locales/i18n_de.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ Beim Einladen von Kontakten bevorzugt der Filter den überschreibenden Wert, wen
234234
"Bitte geben Sie den Verifizierungscode ein, den wir Ihnen an %s \
235235
geschickt haben. Der Code ist eine Stunde lang gültig."
236236
cell_phone
237+
| ContactInformationEmailHint ->
238+
"Um Ihre E-Mail-Adresse anzupassen, folgen Sie bitte folgendem Link."
237239
| ContactLanguage ->
238240
"Bei einigen Experimenten wird in einer anderen Sprache kommuniziert, ohne \
239241
Rücksicht auf die Kontaktsprache."

pool/app/pool_common/locales/i18n_en.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ When inviting contacts, the filter will prefer the overriding value if both are
230230
"Please enter the verification code we sent yout to %s. The code is \
231231
valid for one hour."
232232
cell_phone
233+
| ContactInformationEmailHint ->
234+
"To change your e-mail address, please follow this link."
233235
| ContactLanguage ->
234236
"Some experiments choose to communicate in a different language, \
235237
disregarding your contact language."

pool/web/handler/contact_signup.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ let sign_up_create req =
150150
let%lwt () = Pool_event.handle_events ~tags database_label events in
151151
HttpUtils.(
152152
redirect_to_with_actions
153-
(path_with_language query_language "/email-confirmation")
153+
"/email-confirmation"
154154
[ Message.set
155155
~success:[ Pool_common.Message.EmailConfirmationMessage ]
156156
])

pool/web/view/page/page_contact_edit.ml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,19 @@ let contact_information
353353
let hint_to_html =
354354
CCFun.(Utils.hint_to_string language %> fun hint -> div [ txt hint ])
355355
in
356+
let email_hint =
357+
let link =
358+
HttpUtils.path_with_language query_language "/user/login-information"
359+
in
360+
[ txt
361+
Pool_common.(
362+
Utils.hint_to_string language I18n.ContactInformationEmailHint)
363+
]
364+
|> Notification.notification
365+
language
366+
~link:(link, Pool_common.I18n.LoginInformation)
367+
`Warning
368+
in
356369
let form_title i18n =
357370
h2
358371
~a:[ a_class [ "heading-3" ] ]
@@ -397,7 +410,7 @@ let contact_information
397410
in
398411
let form_as_link url i18n =
399412
form
400-
~a:[ a_method `Post; a_action (Sihl.Web.externalize_path url) ]
413+
~a:[ a_method `Post; a_action (externalize url) ]
401414
[ csrf_element csrf ()
402415
; submit_element ~classnames:[ "as-link" ] language i18n ()
403416
]
@@ -445,20 +458,21 @@ let contact_information
445458
| Some { Pool_user.UnverifiedCellPhone.cell_phone; _ } ->
446459
verify_form cell_phone
447460
in
448-
div [ div ~a:[ a_class [ "grid-col-2"; "gap-lg" ] ] [ form ] ]
461+
div [ email_hint; div ~a:[ a_class [ "grid-col-2"; "gap-lg" ] ] [ form ] ]
449462
|> contact_profile_layout language Pool_common.I18n.ContactInformation
450463
;;
451464

452465
let pause_account Pool_context.{ language; query_language; csrf; _ } ?token () =
453466
let open Pool_common in
467+
let externalize = HttpUtils.externalize_path_with_lang query_language in
454468
let action =
455469
match token with
456-
| None -> "/user/update/pause" |> Sihl.Web.externalize_path
470+
| None -> "/user/update/pause" |> externalize
457471
| Some token ->
458472
Message.add_field_query_params
459473
"/unsubscribe"
460474
[ Message.Field.Token, User_import.Token.value token ]
461-
|> HttpUtils.externalize_path_with_lang query_language
475+
|> externalize
462476
in
463477
let open Utils in
464478
div

pool/web/view/page/page_contact_experiment.ml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let index
2828
waiting_list
2929
past_experiments
3030
custom_fields_ansered
31-
Pool_context.{ language; _ }
31+
Pool_context.{ language; query_language; _ }
3232
=
3333
let list_html ?empty_msg ?note title classnames list =
3434
div
@@ -82,7 +82,8 @@ let index
8282
[ a
8383
~a:
8484
[ a_href
85-
(Sihl.Web.externalize_path
85+
(HttpUtils.externalize_path_with_lang
86+
query_language
8687
(Format.asprintf "/experiments/%s" (Experiment.Id.value id)))
8788
]
8889
[ txt Pool_common.(Message.More |> Utils.control_to_string language) ]
@@ -202,7 +203,7 @@ let show
202203
past_sessions
203204
user_is_enlisted
204205
contact
205-
Pool_context.{ language; csrf; _ }
206+
Pool_context.{ language; query_language; csrf; _ }
206207
=
207208
let open Pool_common in
208209
let hint_to_string = Utils.hint_to_string language in
@@ -236,7 +237,7 @@ let show
236237
Experiment.(experiment |> Public.id |> Id.value)
237238
|> (fun url ->
238239
if user_is_enlisted then Format.asprintf "%s/remove" url else url)
239-
|> Sihl.Web.externalize_path
240+
|> HttpUtils.externalize_path_with_lang query_language
240241
in
241242
let text_blocks =
242243
let base =
@@ -249,7 +250,11 @@ let show
249250
if CCOption.is_none contact.Contact.cell_phone
250251
then
251252
[ Component.Notification.notification
252-
~link:("/user/contact-information", I18n.PersonalDetails)
253+
~link:
254+
( HttpUtils.path_with_language
255+
query_language
256+
"/user/contact-information"
257+
, I18n.PersonalDetails )
253258
language
254259
`Warning
255260
[ txt (hint_to_string I18n.WaitingListPhoneMissingContact) ]

0 commit comments

Comments
 (0)