]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5506'
authorTom Hughes <tom@compton.nu>
Thu, 16 Jan 2025 18:18:06 +0000 (18:18 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 16 Jan 2025 18:18:06 +0000 (18:18 +0000)
app/abilities/ability.rb
app/controllers/accounts/terms_controller.rb
config/locales/en.yml

index 9516a30126ce8f05211fe593386dfe17bd521ba7..05f4952ac21907e0c1fbdcd869f94f134449f726 100644 (file)
@@ -24,13 +24,12 @@ class Ability
       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
@@ -38,6 +37,7 @@ class Ability
         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
index 0513a031c96ad2cdb8ac84f7a91adb7095c45142..45e0cc239f4dcb465e3c50755a1fc111996c70d6 100644 (file)
@@ -20,46 +20,32 @@ module Accounts
       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
index e9b3c15e18be158a1a6bb29b928ee47674a238d1..21a7ce0f2aa85d52c87f0d7f727cb1abcb6485dd 100644 (file)
@@ -318,7 +318,6 @@ 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:"
@@ -326,6 +325,8 @@ en:
           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
@@ -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