Skip to content

Commit

Permalink
fix(enqueue): don not override geo ip disable if it is setup directly…
Browse files Browse the repository at this point in the history
… in Message
  • Loading branch information
theartofdevel committed Feb 6, 2024
1 parent bc07697 commit 09ef0ed
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions posthog.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,29 @@ func (c *client) Enqueue(msg Message) (err error) {
case Alias:
m.Type = "alias"
m.Timestamp = makeTimestamp(m.Timestamp, ts)
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
if _, ok := m.properties[GeoIPDisableKey]; !ok {
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
}
}
msg = m

case Identify:
m.Type = "identify"
m.Timestamp = makeTimestamp(m.Timestamp, ts)
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
if _, ok := m.Properties[GeoIPDisableKey]; !ok {
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
}
}
msg = m

case GroupIdentify:
m.Timestamp = makeTimestamp(m.Timestamp, ts)
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
if _, ok := m.Properties[GeoIPDisableKey]; !ok {
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
}
}
msg = m

Expand All @@ -211,8 +217,10 @@ func (c *client) Enqueue(msg Message) (err error) {
}
m.Properties["$active_feature_flags"] = featureKeys
}
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
if _, ok := m.Properties[GeoIPDisableKey]; !ok {
if c.Config.DisableGeoIP != nil {
m.SetProperty(GeoIPDisableKey, *c.Config.DisableGeoIP)
}
}
msg = m

Expand Down

0 comments on commit 09ef0ed

Please sign in to comment.