Disable recommendations by default when requiring consent
The GDPR is open for interpretation, and it isn't clear whether showing users recommended proposals and debates while browsing the site is considered a notification that needs to be explicitly accepted. Since we aren't sure whether this is necessary, we're taking the safe approach and disabling recommendations by default.
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
include Verification
|
include Verification
|
||||||
attribute :registering_from_web, default: false
|
attribute :registering_from_web, default: false
|
||||||
%i[newsletter email_digest email_on_direct_message].each do |field|
|
%i[newsletter email_digest email_on_direct_message recommended_debates
|
||||||
|
recommended_proposals].each do |field|
|
||||||
attribute field, :boolean, default: -> { !Setting["feature.gdpr.require_consent_for_notifications"] }
|
attribute field, :boolean, default: -> { !Setting["feature.gdpr.require_consent_for_notifications"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class RemoveDefaultValueInUserRecommendations < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
change_table :users do |t|
|
||||||
|
t.change_default :recommended_debates, from: true, to: nil
|
||||||
|
t.change_default :recommended_proposals, from: true, to: nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2025_10_09_084919) do
|
ActiveRecord::Schema[7.1].define(version: 2025_10_09_085327) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_trgm"
|
enable_extension "pg_trgm"
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -1625,8 +1625,8 @@ ActiveRecord::Schema[7.1].define(version: 2025_10_09_084919) do
|
|||||||
t.integer "failed_email_digests_count", default: 0
|
t.integer "failed_email_digests_count", default: 0
|
||||||
t.text "former_users_data_log", default: ""
|
t.text "former_users_data_log", default: ""
|
||||||
t.boolean "public_interests", default: false
|
t.boolean "public_interests", default: false
|
||||||
t.boolean "recommended_debates", default: true
|
t.boolean "recommended_debates"
|
||||||
t.boolean "recommended_proposals", default: true
|
t.boolean "recommended_proposals"
|
||||||
t.string "subscriptions_token"
|
t.string "subscriptions_token"
|
||||||
t.integer "failed_attempts", default: 0, null: false
|
t.integer "failed_attempts", default: 0, null: false
|
||||||
t.datetime "locked_at", precision: nil
|
t.datetime "locked_at", precision: nil
|
||||||
|
|||||||
@@ -146,6 +146,34 @@ describe User do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#recommended_debates" do
|
||||||
|
it "is true by default when the consent for notifications setting is disabled" do
|
||||||
|
Setting["feature.gdpr.require_consent_for_notifications"] = false
|
||||||
|
|
||||||
|
expect(build(:user).recommended_debates).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is false by default when the consent for notifications setting is enabled" do
|
||||||
|
Setting["feature.gdpr.require_consent_for_notifications"] = true
|
||||||
|
|
||||||
|
expect(build(:user).recommended_debates).to be false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#recommended_proposals" do
|
||||||
|
it "is true by default when the consent for notifications setting is disabled" do
|
||||||
|
Setting["feature.gdpr.require_consent_for_notifications"] = false
|
||||||
|
|
||||||
|
expect(build(:user).recommended_proposals).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is false by default when the consent for notifications setting is enabled" do
|
||||||
|
Setting["feature.gdpr.require_consent_for_notifications"] = true
|
||||||
|
|
||||||
|
expect(build(:user).recommended_proposals).to be false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#official_position_badge" do
|
describe "#official_position_badge" do
|
||||||
it "is false by default" do
|
it "is false by default" do
|
||||||
expect(subject.official_position_badge).to be false
|
expect(subject.official_position_badge).to be false
|
||||||
|
|||||||
Reference in New Issue
Block a user