OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix: avoid overwrite profile properties (geo etc) when profile is from server
Carl-Gerhard Lindesvärd329f76b7ced4
diff --git a/packages/db/src/buffers/profile-buffer.ts b/packages/db/src/buffers/profile-buffer.tsindex 7bfb9c809..fc82937f1 100644--- a/packages/db/src/buffers/profile-buffer.ts+++ b/packages/db/src/buffers/profile-buffer.ts@@ -68,6 +68,30 @@ export class ProfileBuffer extends BaseBuffer {const existingProfile = await this.fetchProfile(profile, logger);+ // Delete any properties that are not server related if we have a non-server profile+ if (+ existingProfile?.properties.device !== 'server' &&+ profile.properties.device === 'server'+ ) {+ profile.properties = omit(+ [+ 'city',+ 'country',+ 'region',+ 'longitude',+ 'latitude',+ 'os',+ 'osVersion',+ 'browser',+ 'device',+ 'isServer',+ 'os_version',+ 'browser_version',+ ],+ profile.properties,+ );+ }+const mergedProfile: IClickhouseProfile = existingProfile? deepMergeObjects(existingProfile, omit(['created_at'], profile)): profile;