File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ const context = {
106106 type : 'boolean' ,
107107 description : 'Anonymous -- whether the user has github.com cookies set.' ,
108108 } ,
109+ dotcom_user : {
110+ type : 'string' ,
111+ description : 'The cookie value of dotcom_user' ,
112+ } ,
109113
110114 // Device information
111115 os : {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ router.post(
5252
5353 // Validate the data matches the corresponding data schema
5454 const validate = validators [ type ]
55- if ( ! validate ( req . body ) ) {
55+ if ( ! validate ( body ) ) {
5656 // This protects so we don't bother sending the same validation
5757 // error, per user, more than once (per time interval).
5858 // This helps if we're bombarded with junk bot traffic. So it
@@ -84,6 +84,10 @@ router.post(
8484 body . survey_comment_language = await getGuessedLanguage ( body . survey_comment )
8585 }
8686
87+ // Add dotcom_user to the context if it's available
88+ // JSON.stringify removes `undefined` values but not `null`, and we don't want to send `null` to Hydro
89+ body . context . dotcom_user = req . cookies ?. dotcom_user ? req . cookies . dotcom_user : undefined
90+
8791 await publish ( {
8892 schema : hydroNames [ type ] ,
8993 value : omit ( body , OMIT_FIELDS ) ,
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ export type EventProps = {
3434 path_type : string
3535 status : number
3636 is_logged_in : boolean
37+ dotcom_user : string
3738 os : string
3839 os_version : string
3940 browser : string
You can’t perform that action at this time.
0 commit comments