Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/5506'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jan 16, 2025
2 parents 702a861 + 87e7f88 commit dfc843e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
4 changes: 2 additions & 2 deletions app/abilities/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ def initialize(user)
can [:create, :destroy], :session
can [:read, :data, :georss], Trace
can [:read, :create, :suspended, :auth_success, :auth_failure], User
can [:read, :update], :account_terms
can :read, UserBlock
end

if user&.active?
can :welcome, :site
can :read, :deletion
can :read, [:deletion, :account_terms]

if Settings.status != "database_offline"
can [:subscribe, :unsubscribe], Changeset
can [:read, :create, :update, :destroy], :oauth2_application
can [:read, :destroy], :oauth2_authorized_application
can [:read, :create, :destroy], :oauth2_authorization
can [:update, :destroy], :account
can :update, :account_terms
can :read, :dashboard
can [:create, :subscribe, :unsubscribe], DiaryEntry
can :update, DiaryEntry, :user => user
Expand Down
30 changes: 8 additions & 22 deletions app/controllers/accounts/terms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,32 @@ def show
else
@title = t ".title"

if current_user&.terms_agreed?
if current_user.terms_agreed?
# Already agreed to terms, so just show settings
redirect_to edit_account_path
elsif current_user.nil?
redirect_to login_path(:referer => request.fullpath)
end
end
end

def update
@title = t "users.new.title"

if params[:decline] || !(params[:read_tou] && params[:read_ct])
if current_user
current_user.terms_seen = true

flash[:notice] = { :partial => "accounts/terms/terms_declined_flash" } if current_user.save

referer = safe_referer(params[:referer]) if params[:referer]
current_user.terms_seen = true

redirect_to referer || edit_account_path
elsif params[:decline]
redirect_to t("users.terms.declined"), :allow_other_host => true
else
redirect_to account_terms_path
end
elsif current_user
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

flash[:notice] = t "users.new.terms accepted" if current_user.save
flash[:notice] = t ".terms accepted" if current_user.save
end
end

referer = safe_referer(params[:referer]) if params[:referer]
referer = safe_referer(params[:referer]) if params[:referer]

redirect_to referer || edit_account_path
end
redirect_to referer || edit_account_path
end
end
end
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,15 @@ en:
readable_summary: human readable summary
informal_translations: informal translations
continue: "Continue"
declined: "https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
cancel: "Cancel"
you need to accept or decline: "Please read and then either accept or decline the new Contributor Terms to continue."
legale_select: "Country of residence:"
legale_names:
france: "France"
italy: "Italy"
rest_of_world: "Rest of the world"
update:
terms accepted: "Thanks for accepting the new contributor terms!"
terms_declined_flash:
terms_declined_html: We are sorry that you have decided to not accept the new Contributor Terms. For more information, please see %{terms_declined_link}.
terms_declined_link: this wiki page
Expand Down Expand Up @@ -2772,7 +2773,6 @@ en:
contributor_terms_url: "https://osmfoundation.org/wiki/Licence/Contributor_Terms"
contributor_terms: "contributor terms"
continue: Sign Up
terms accepted: "Thanks for accepting the new contributor terms!"
email_help:
privacy_policy: privacy policy
privacy_policy_url: https://osmfoundation.org/wiki/Privacy_Policy
Expand Down

0 comments on commit dfc843e

Please sign in to comment.