-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed that user-info was not showing up in sentry error sends. (app…
…arently the "auth" key on the context-object is reserved or something; so now putting the data under "user" key) * Removed map-view data from sentry error sends. (was meant to help with debugging, but perhaps too sensitive in some cases)
- Loading branch information
Showing
1 changed file
with
16 additions
and
30 deletions.
There are no files selected for viewing
46 changes: 16 additions & 30 deletions
46
Packages/client/Source/Utils/AutoRuns/AddUserInfoToRavenContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,25 @@ | ||
import {autorun} from "web-vcore/nm/mobx.js"; | ||
import {GetOpenMapID} from "Store/main"; | ||
import {GetMapView} from "Store/main/maps/mapViews/$mapView.js"; | ||
import {Me} from "dm_common"; | ||
import {Clone} from "web-vcore/nm/js-vextensions.js"; | ||
import Raven from "web-vcore/nm/raven-js"; | ||
import {Me} from "dm_common"; | ||
import {AutoRun_HandleBail} from "./@Helpers.js"; | ||
|
||
let lastUser; | ||
let lastContextData; // only gets updated when one of the above components change | ||
AutoRun_HandleBail(()=>{ | ||
// edit: something used to be here? | ||
let lastAuth; | ||
let lastMapView; | ||
let lastContextData; // only gets updated when one of the above components change | ||
AutoRun_HandleBail(()=>{ | ||
// const auth = GetAuth(); | ||
//const auth = GetAuth_Raw(); | ||
const auth = Me(); | ||
const mapView = GetOpenMapID() ? GetMapView(GetOpenMapID()) : null; | ||
const user = Me(); | ||
|
||
let newContextData; | ||
const ExtendNewContextData = newData=>{ | ||
if (newContextData == null) newContextData = Clone(lastContextData || {}); | ||
newContextData.Extend(newData); | ||
}; | ||
// if (auth != lastAuth) ExtendNewContextData({ auth: auth ? auth.IncludeKeys('id', 'displayName') : null }); | ||
//if (auth != lastAuth) ExtendNewContextData({auth: auth ? auth.IncludeKeys("uid", "displayName", "email", "photoURL") : null}); | ||
if (auth != lastAuth) ExtendNewContextData({auth: auth ? auth.IncludeKeys("id", "displayName", /*"email",*/ "photoURL") : null}); | ||
if (mapView != lastMapView) ExtendNewContextData({mapView}); | ||
let newContextData; | ||
const ExtendNewContextData = newData=>{ | ||
if (newContextData == null) newContextData = Clone(lastContextData || {}); | ||
Object.assign(newContextData, newData); | ||
}; | ||
if (user != lastUser) ExtendNewContextData({user}); | ||
|
||
if (newContextData != null) { | ||
// Log('Setting user-context: ', newContextData); | ||
Raven.setUserContext(newContextData); | ||
lastContextData = newContextData; | ||
} | ||
if (newContextData != null) { | ||
//console.log("Setting context data: ", newContextData); | ||
Raven.setUserContext(newContextData); | ||
lastContextData = newContextData; | ||
} | ||
|
||
lastAuth = auth; | ||
lastMapView = mapView; | ||
}); | ||
lastUser = user; | ||
}, {name: "AddUserInfoToRavenContext"}); |