File tree 3 files changed +10
-1
lines changed
3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ const context = {
106
106
type : 'boolean' ,
107
107
description : 'Anonymous -- whether the user has github.com cookies set.' ,
108
108
} ,
109
+ dotcom_user : {
110
+ type : 'string' ,
111
+ description : 'The cookie value of dotcom_user' ,
112
+ } ,
109
113
110
114
// Device information
111
115
os : {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ router.post(
52
52
53
53
// Validate the data matches the corresponding data schema
54
54
const validate = validators [ type ]
55
- if ( ! validate ( req . body ) ) {
55
+ if ( ! validate ( body ) ) {
56
56
// This protects so we don't bother sending the same validation
57
57
// error, per user, more than once (per time interval).
58
58
// This helps if we're bombarded with junk bot traffic. So it
@@ -84,6 +84,10 @@ router.post(
84
84
body . survey_comment_language = await getGuessedLanguage ( body . survey_comment )
85
85
}
86
86
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
+
87
91
await publish ( {
88
92
schema : hydroNames [ type ] ,
89
93
value : omit ( body , OMIT_FIELDS ) ,
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ export type EventProps = {
34
34
path_type : string
35
35
status : number
36
36
is_logged_in : boolean
37
+ dotcom_user : string
37
38
os : string
38
39
os_version : string
39
40
browser : string
You can’t perform that action at this time.
0 commit comments