Browse Source

Change /settings/preferences to redirect to appearance, add /settings/preferences/other (#10988)

Eugen Rochko 1 week ago
parent
commit
560ec24e58
No account linked to committer's email address

+ 9
- 0
app/controllers/settings/preferences/other_controller.rb View File

@@ -0,0 +1,9 @@
1
+# frozen_string_literal: true
2
+
3
+class Settings::Preferences::OtherController < Settings::PreferencesController
4
+  private
5
+
6
+  def after_update_redirect_path
7
+    settings_preferences_other_path
8
+  end
9
+end

app/views/settings/preferences/show.html.haml → app/views/settings/preferences/other/show.html.haml View File


+ 2
- 2
config/navigation.rb View File

@@ -10,10 +10,10 @@ SimpleNavigation::Configuration.run do |navigation|
10 10
       s.item :identity_proofs, safe_join([fa_icon('key fw'), t('settings.identity_proofs')]), settings_identity_proofs_path, highlights_on: %r{/settings/identity_proofs*}, if: proc { current_account.identity_proofs.exists? }
11 11
     end
12 12
 
13
-    n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_appearance_url do |s|
13
+    n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_url do |s|
14 14
       s.item :appearance, safe_join([fa_icon('desktop fw'), t('settings.appearance')]), settings_preferences_appearance_url
15 15
       s.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_preferences_notifications_url
16
-      s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_url
16
+      s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_other_url
17 17
     end
18 18
 
19 19
     n.item :relationships, safe_join([fa_icon('users fw'), t('settings.relationships')]), relationships_url

+ 4
- 2
config/routes.rb View File

@@ -87,15 +87,17 @@ Rails.application.routes.draw do
87 87
   get '/explore', to: 'directories#index', as: :explore
88 88
   get '/explore/:id', to: 'directories#show', as: :explore_hashtag
89 89
 
90
-  get '/settings', to: redirect('/settings/preferences')
90
+  get '/settings', to: redirect('/settings/profile')
91 91
 
92 92
   namespace :settings do
93 93
     resource :profile, only: [:show, :update]
94
-    resource :preferences, only: [:show, :update]
94
+
95
+    get :preferences, to: redirect('/settings/preferences/appearance')
95 96
 
96 97
     namespace :preferences do
97 98
       resource :appearance, only: [:show, :update], controller: :appearance
98 99
       resource :notifications, only: [:show, :update]
100
+      resource :other, only: [:show, :update], controller: :other
99 101
     end
100 102
 
101 103
     resource :import, only: [:show, :create]

spec/controllers/settings/preferences_controller_spec.rb → spec/controllers/settings/preferences/other_controller_spec.rb View File

@@ -1,6 +1,6 @@
1 1
 require 'rails_helper'
2 2
 
3
-describe Settings::PreferencesController do
3
+describe Settings::Preferences::OtherController do
4 4
   render_views
5 5
 
6 6
   let(:user) { Fabricate(:user, filtered_languages: []) }
@@ -20,7 +20,7 @@ describe Settings::PreferencesController do
20 20
     it 'updates the user record' do
21 21
       put :update, params: { user: { locale: 'en', chosen_languages: ['es', 'fr', ''] } }
22 22
 
23
-      expect(response).to redirect_to(settings_preferences_path)
23
+      expect(response).to redirect_to(settings_preferences_other_path)
24 24
       user.reload
25 25
       expect(user.locale).to eq 'en'
26 26
       expect(user.chosen_languages).to eq ['es', 'fr']
@@ -37,7 +37,7 @@ describe Settings::PreferencesController do
37 37
         }
38 38
       }
39 39
 
40
-      expect(response).to redirect_to(settings_preferences_path)
40
+      expect(response).to redirect_to(settings_preferences_other_path)
41 41
       user.reload
42 42
       expect(user.settings['boost_modal']).to be true
43 43
       expect(user.settings['delete_modal']).to be false

Loading…
Cancel
Save