Fix opt-out button opening panel instead of rejecting
In OPT_OUT mode the button_opt_out text was mapped to button_customize, which opens the preference panel. Map it to button_reject_all instead so the button performs a one-click reject for all OPT_OUT regulations. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -1616,8 +1616,8 @@ func remapTextsForConsentMode(texts map[string]string, consentMode string, regul
|
||||
remapTextKey(texts, "banner_title_opt_out", "banner_title")
|
||||
remapTextKey(texts, "banner_description_opt_out", "banner_description")
|
||||
remapTextKey(texts, "button_acknowledge", "button_accept_all")
|
||||
remapTextKey(texts, "button_opt_out", "button_customize")
|
||||
texts["button_reject_all"] = ""
|
||||
remapTextKey(texts, "button_opt_out", "button_reject_all")
|
||||
texts["button_customize"] = ""
|
||||
|
||||
case regulation == RegulationNone:
|
||||
remapTextKey(texts, "banner_title_notice", "banner_title")
|
||||
|
||||
@@ -308,13 +308,15 @@ func TestRemapTextsForConsentMode(t *testing.T) {
|
||||
assert.Empty(t, texts["button_customize"])
|
||||
})
|
||||
|
||||
t.Run("opt out mode clears reject", func(t *testing.T) {
|
||||
t.Run("opt out mode maps opt out to reject and clears customize", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
texts := baseTexts()
|
||||
texts["button_opt_out"] = "Do Not Sell"
|
||||
remapTextsForConsentMode(texts, ConsentModeOptOut, RegulationCCPA)
|
||||
|
||||
assert.Empty(t, texts["button_reject_all"])
|
||||
assert.Equal(t, "Do Not Sell", texts["button_reject_all"])
|
||||
assert.Empty(t, texts["button_customize"])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user