Merge pull request #5514 from AntonKhorev/pd-declaration

Remove public domain checkbox from signup and terms pages
This commit is contained in:
Andy Allan 2025-02-15 14:03:55 +00:00 committed by GitHub
commit aebacc88de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 222 additions and 66 deletions

View file

@ -29,7 +29,7 @@ class Ability
if user&.active?
can :welcome, :site
can :read, [:deletion, :account_terms]
can :read, [:deletion, :account_terms, :account_pd_declaration]
if Settings.status != "database_offline"
can [:read, :create, :destroy], :changeset_subscription
@ -38,6 +38,7 @@ class Ability
can [:read, :create, :destroy], :oauth2_authorization
can [:update, :destroy], :account
can :update, :account_terms
can :create, :account_pd_declaration
can :read, :dashboard
can [:create, :subscribe, :unsubscribe], DiaryEntry
can :update, DiaryEntry, :user => user

View file

@ -0,0 +1,28 @@
module Accounts
class PdDeclarationsController < ApplicationController
layout "site"
before_action :authorize_web
before_action :set_locale
authorize_resource :class => :account_pd_declaration
def show; end
def create
if current_user.consider_pd
flash[:warning] = t(".already_declared")
else
current_user.consider_pd = params[:consider_pd]
if current_user.consider_pd
flash[:notice] = t(".successfully_declared") if current_user.save
else
flash[:warning] = t(".did_not_confirm")
end
end
redirect_to edit_account_path
end
end
end

View file

@ -33,7 +33,6 @@ module Accounts
flash[:notice] = { :partial => "accounts/terms/terms_declined_flash" } if current_user.save
else
unless current_user.terms_agreed?
current_user.consider_pd = params[:user][:consider_pd]
current_user.tou_agreed = Time.now.utc
current_user.terms_agreed = Time.now.utc
current_user.terms_seen = true

View file

@ -222,8 +222,7 @@ class UsersController < ApplicationController
def user_params
params.require(:user).permit(:email, :display_name,
:auth_provider, :auth_uid,
:pass_crypt, :pass_crypt_confirmation,
:consider_pd)
:pass_crypt, :pass_crypt_confirmation)
end
##

View file

@ -29,14 +29,18 @@
<small class="form-text text-body-secondary">(<a href="<%= t ".openid.link" %>" target="_new"><%= t ".openid.link text" %></a>)</small>
</fieldset>
<div class="mb-3">
<label class="form-label"><%= t ".contributor terms.heading" %></label>
<div class="mb-3 d-flex flex-column flex-sm-row column-gap-1">
<label class="form-label text-nowrap mb-0"><%= t ".contributor terms.heading" %></label>
<span class="form-text text-body-secondary">
<% if current_user.terms_agreed? %>
<%= t ".contributor terms.agreed" %>
(<a href="<%= t ".contributor terms.link" %>" target="_new"><%= t ".contributor terms.link text" %></a>)
<br>
<% if current_user.consider_pd? %>
<%= t ".contributor terms.agreed_with_pd" %>
<% else %>
<%= t ".contributor terms.not_agreed_with_pd" %>
(<%= link_to t(".contributor terms.pd_link_text"), account_pd_declaration_path %>)
<% end %>
<% else %>
<%= t ".contributor terms.not yet agreed" %>

View file

@ -0,0 +1,14 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<%= bootstrap_form_tag do |f| %>
<%= f.form_group :help => link_to(t(".consider_pd_why"), t(".consider_pd_why_url"), :target => :new) do %>
<%= f.check_box :consider_pd,
:label => t(".consider_pd"),
:autocomplete => :off,
:checked => current_user.consider_pd,
:disabled => current_user.consider_pd %>
<% end %>
<%= f.primary t(".confirm"), :disabled => current_user.consider_pd %>
<% end %>

View file

@ -72,13 +72,4 @@
<%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :disabled => true, :class => "btn btn-primary") %>
<%= submit_tag(t(".cancel"), :name => "decline", :id => "decline", :class => "btn btn-outline-secondary") %>
</div>
<div class="mb-3">
<div class="form-check">
<%= check_box("user", "consider_pd", :class => "form-check-input") %>
<label for="user_consider_pd" class="form-check-label">
<%= t ".consider_pd" %>
</label>
<span class="minorNote">(<%= link_to(t(".consider_pd_why"), t(".consider_pd_why_url"), :target => :new) %>)</span>
</div>
<% end %>

View file

@ -78,17 +78,9 @@
:contributor_terms_link => link_to(t(".by_signing_up.contributor_terms"),
t(".by_signing_up.contributor_terms_url"),
:target => :new)) %></p>
<%= f.form_group do %>
<%= f.check_box :consider_pd,
:tabindex => 5,
:label => t(".consider_pd_html",
:consider_pd_link => link_to(t(".consider_pd"),
t(".consider_pd_url"),
:target => :new)) %>
<% end %>
<div class="mb-3">
<%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :class => "btn btn-primary", :tabindex => 6) %>
<%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :class => "btn btn-primary", :tabindex => 5) %>
</div>
<% end %>