Skip to content

Commit

Permalink
Removed old 2.5 location usages (#3923)
Browse files Browse the repository at this point in the history
  • Loading branch information
VeronikaSolovei9 authored Sep 30, 2024
1 parent 664f2ff commit fe57c0d
Show file tree
Hide file tree
Showing 27 changed files with 488 additions and 418 deletions.
2 changes: 1 addition & 1 deletion adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func preprocess(imp *openrtb2.Imp, reqExt *openxReqExt) error {

if imp.Video != nil {
videoCopy := *imp.Video
if bidderExt.Prebid != nil && bidderExt.Prebid.IsRewardedInventory != nil && *bidderExt.Prebid.IsRewardedInventory == 1 {
if imp.Rwdd == 1 {
videoCopy.Ext = json.RawMessage(`{"rewarded":1}`)
} else {
videoCopy.Ext = nil
Expand Down
7 changes: 3 additions & 4 deletions adapters/openx/openxtest/exemplary/video-rewarded.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
}
},
"instl": 1,
"rwdd": 1,
"ext": {
"bidder": {
"unit": "539439964",
"delDomain": "se-demo-d.openx.net"
},
"prebid": {
"is_rewarded_inventory": 1
}
}
}
Expand All @@ -46,7 +44,8 @@
}
},
"tagid": "539439964",
"instl": 1
"instl": 1,
"rwdd": 1
}
],
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion amp/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func buildGdprTCF2ConsentWriter(ampParams Params) gdpr.ConsentWriter {
// set regs.ext.gdpr if non-nil gdpr_applies was set to true
gdprValue = parseGdprApplies(ampParams.GdprApplies)
}
writer.RegExtGDPR = &gdprValue
writer.GDPR = &gdprValue

return writer
}
Expand Down
40 changes: 20 additions & 20 deletions amp/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
RegExtGDPR: &int8One,
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
GDPR: &int8One,
},
warning: nil,
},
Expand Down Expand Up @@ -378,8 +378,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
RegExtGDPR: &int8One,
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
GDPR: &int8One,
},
warning: nil,
},
Expand All @@ -400,8 +400,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "INVALID_GDPR",
RegExtGDPR: &int8One,
Consent: "INVALID_GDPR",
GDPR: &int8One,
},
warning: &errortypes.Warning{
Message: "Consent string 'INVALID_GDPR' is not a valid TCF2 consent string.",
Expand All @@ -420,8 +420,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "INVALID_GDPR",
RegExtGDPR: &int8Zero,
Consent: "INVALID_GDPR",
GDPR: &int8Zero,
},
warning: &errortypes.Warning{
Message: "Consent string 'INVALID_GDPR' is not a valid TCF2 consent string.",
Expand All @@ -440,8 +440,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
RegExtGDPR: &int8Zero,
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
GDPR: &int8Zero,
},
warning: nil,
},
Expand All @@ -457,8 +457,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
RegExtGDPR: &int8One,
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
GDPR: &int8One,
},
warning: nil,
},
Expand All @@ -473,8 +473,8 @@ func TestPrivacyReader(t *testing.T) {
},
expected: expectedResults{
policyWriter: gdpr.ConsentWriter{
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
RegExtGDPR: &int8One,
Consent: "CPdiPIJPdiPIJACABBENAzCv_____3___wAAAQNd_X9cAAAAAAAA",
GDPR: &int8One,
},
warning: nil,
},
Expand Down Expand Up @@ -559,8 +559,8 @@ func TestBuildGdprTCF2ConsentWriter(t *testing.T) {
desc: "gdpr_applies not set",
inParams: Params{Consent: consentString},
expectedWriter: gdpr.ConsentWriter{
Consent: consentString,
RegExtGDPR: &int8One,
Consent: consentString,
GDPR: &int8One,
},
},
{
Expand All @@ -570,8 +570,8 @@ func TestBuildGdprTCF2ConsentWriter(t *testing.T) {
GdprApplies: &boolFalse,
},
expectedWriter: gdpr.ConsentWriter{
Consent: consentString,
RegExtGDPR: &int8Zero,
Consent: consentString,
GDPR: &int8Zero,
},
},
{
Expand All @@ -581,8 +581,8 @@ func TestBuildGdprTCF2ConsentWriter(t *testing.T) {
GdprApplies: &boolTrue,
},
expectedWriter: gdpr.ConsentWriter{
Consent: consentString,
RegExtGDPR: &int8One,
Consent: consentString,
GDPR: &int8One,
},
},
}
Expand Down
10 changes: 3 additions & 7 deletions analytics/agma/agma_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,11 @@ func (l *AgmaLogger) extractPublisherAndSite(requestWrapper *openrtb_ext.Request
}

func (l *AgmaLogger) shouldTrackEvent(requestWrapper *openrtb_ext.RequestWrapper) (bool, string) {
userExt, err := requestWrapper.GetUserExt()
if err != nil || userExt == nil {
if requestWrapper.User == nil {
return false, ""
}
consent := userExt.GetConsent()
if consent == nil {
return false, ""
}
consentStr := *consent
consentStr := requestWrapper.User.Consent

parsedConsent, err := vendorconsent.ParseString(consentStr)
if err != nil {
return false, ""
Expand Down
12 changes: 6 additions & 6 deletions analytics/agma/agma_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var mockValidAuctionObject = analytics.AuctionObject{
UA: "ua",
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
Consent: agmaConsent,
},
},
},
Expand All @@ -59,7 +59,7 @@ var mockValidVideoObject = analytics.VideoObject{
UA: "ua",
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
Consent: agmaConsent,
},
},
},
Expand All @@ -81,7 +81,7 @@ var mockValidAmpObject = analytics.AmpObject{
UA: "ua",
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
Consent: agmaConsent,
},
},
},
Expand Down Expand Up @@ -324,7 +324,7 @@ func TestShouldTrackMultipleAccounts(t *testing.T) {
},
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
Consent: agmaConsent,
},
},
})
Expand All @@ -342,7 +342,7 @@ func TestShouldTrackMultipleAccounts(t *testing.T) {
},
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"consent": "` + agmaConsent + `"}`),
Consent: agmaConsent,
},
},
})
Expand Down Expand Up @@ -656,7 +656,7 @@ func TestRaceEnd2End(t *testing.T) {

time.Sleep(250 * time.Millisecond)

expected := "[{\"type\":\"amp\",\"id\":\"some-id\",\"code\":\"abcd\",\"site\":{\"id\":\"track-me-site\",\"publisher\":{\"id\":\"track-me\"}},\"device\":{\"ua\":\"ua\"},\"user\":{\"ext\":{\"consent\": \"" + agmaConsent + "\"}},\"created_at\":\"2023-02-01T00:00:00Z\"},{\"type\":\"amp\",\"id\":\"some-id\",\"code\":\"abcd\",\"site\":{\"id\":\"track-me-site\",\"publisher\":{\"id\":\"track-me\"}},\"device\":{\"ua\":\"ua\"},\"user\":{\"ext\":{\"consent\": \"" + agmaConsent + "\"}},\"created_at\":\"2023-02-01T00:00:00Z\"}]"
expected := "[{\"type\":\"amp\",\"id\":\"some-id\",\"code\":\"abcd\",\"site\":{\"id\":\"track-me-site\",\"publisher\":{\"id\":\"track-me\"}},\"device\":{\"ua\":\"ua\"},\"user\":{\"consent\":\"" + agmaConsent + "\"},\"created_at\":\"2023-02-01T00:00:00Z\"},{\"type\":\"amp\",\"id\":\"some-id\",\"code\":\"abcd\",\"site\":{\"id\":\"track-me-site\",\"publisher\":{\"id\":\"track-me\"}},\"device\":{\"ua\":\"ua\"},\"user\":{\"consent\":\"" + agmaConsent + "\"},\"created_at\":\"2023-02-01T00:00:00Z\"}]"

mu.Lock()
actual := requestBodyAsString
Expand Down
Loading

0 comments on commit fe57c0d

Please sign in to comment.