File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,9 @@ def current_user
48
48
49
49
def viewing_user
50
50
@viewing_user ||= current_user || begin
51
- if cookies [ :identity ]
52
- User . with_username ( cookies [ :identity ] )
53
- end
51
+ if cookies [ :identity ]
52
+ User . with_username ( cookies [ :identity ] )
53
+ end
54
54
end
55
55
end
56
56
@@ -69,12 +69,17 @@ def sign_in(user)
69
69
end
70
70
71
71
def mixpanel_cookie
72
- ( cookies [ "mp_#{ ENV [ 'MIXPANEL_TOKEN' ] } _mixpanel" ] && JSON . parse ( cookies [ "mp_#{ ENV [ 'MIXPANEL_TOKEN' ] } _mixpanel" ] ) ) || { }
72
+ mp_cookie = cookies [ "mp_#{ ENV [ 'MIXPANEL_TOKEN' ] } _mixpanel" ]
73
+ if mp_cookie . present?
74
+ JSON . parse ( mp_cookie )
75
+ else
76
+ { }
77
+ end
73
78
end
74
79
75
80
def ensure_and_reconcile_tracking_code
76
81
if cookies [ :trc ] . blank?
77
- session [ :new_visit ] = true
82
+ session [ :new_visit ] = true
78
83
cookies . permanent [ :trc ] = mixpanel_cookie [ 'distinct_id' ]
79
84
end
80
85
@@ -233,7 +238,7 @@ def record_event(action_name, options = {})
233
238
options . merge! ( { 'signed in' => false ,
234
239
'member' => cookies [ :identity ] && User . exists? ( username : cookies [ :identity ] ) ,
235
240
'first visit' => session [ :new_visit ]
236
- } )
241
+ } )
237
242
end
238
243
239
244
#options.merge!('signed up on' => current_user.created_at.to_formatted_s(:mixpanel),
@@ -265,9 +270,9 @@ def ajax_redirect_to(uri)
265
270
respond_to do |format |
266
271
format . json do
267
272
render json : {
268
- status : :redirect ,
269
- to : uri
270
- } . to_json
273
+ status : :redirect ,
274
+ to : uri
275
+ } . to_json
271
276
end
272
277
end
273
278
end
You can’t perform that action at this time.
0 commit comments