Change /settings/preferences to redirect to appearance, add /settings/preferences/other (#10988)
parent
cdb420862e
commit
560ec24e58
|
@ -0,0 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Settings::Preferences::OtherController < Settings::PreferencesController
|
||||||
|
private
|
||||||
|
|
||||||
|
def after_update_redirect_path
|
||||||
|
settings_preferences_other_path
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,10 +10,10 @@ SimpleNavigation::Configuration.run do |navigation|
|
||||||
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? }
|
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? }
|
||||||
end
|
end
|
||||||
|
|
||||||
n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_appearance_url do |s|
|
n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_url do |s|
|
||||||
s.item :appearance, safe_join([fa_icon('desktop fw'), t('settings.appearance')]), settings_preferences_appearance_url
|
s.item :appearance, safe_join([fa_icon('desktop fw'), t('settings.appearance')]), settings_preferences_appearance_url
|
||||||
s.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_preferences_notifications_url
|
s.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_preferences_notifications_url
|
||||||
s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_url
|
s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_other_url
|
||||||
end
|
end
|
||||||
|
|
||||||
n.item :relationships, safe_join([fa_icon('users fw'), t('settings.relationships')]), relationships_url
|
n.item :relationships, safe_join([fa_icon('users fw'), t('settings.relationships')]), relationships_url
|
||||||
|
|
|
@ -87,15 +87,17 @@ Rails.application.routes.draw do
|
||||||
get '/explore', to: 'directories#index', as: :explore
|
get '/explore', to: 'directories#index', as: :explore
|
||||||
get '/explore/:id', to: 'directories#show', as: :explore_hashtag
|
get '/explore/:id', to: 'directories#show', as: :explore_hashtag
|
||||||
|
|
||||||
get '/settings', to: redirect('/settings/preferences')
|
get '/settings', to: redirect('/settings/profile')
|
||||||
|
|
||||||
namespace :settings do
|
namespace :settings do
|
||||||
resource :profile, only: [:show, :update]
|
resource :profile, only: [:show, :update]
|
||||||
resource :preferences, only: [:show, :update]
|
|
||||||
|
get :preferences, to: redirect('/settings/preferences/appearance')
|
||||||
|
|
||||||
namespace :preferences do
|
namespace :preferences do
|
||||||
resource :appearance, only: [:show, :update], controller: :appearance
|
resource :appearance, only: [:show, :update], controller: :appearance
|
||||||
resource :notifications, only: [:show, :update]
|
resource :notifications, only: [:show, :update]
|
||||||
|
resource :other, only: [:show, :update], controller: :other
|
||||||
end
|
end
|
||||||
|
|
||||||
resource :import, only: [:show, :create]
|
resource :import, only: [:show, :create]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Settings::PreferencesController do
|
describe Settings::Preferences::OtherController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) { Fabricate(:user, filtered_languages: []) }
|
let(:user) { Fabricate(:user, filtered_languages: []) }
|
||||||
|
@ -20,7 +20,7 @@ describe Settings::PreferencesController do
|
||||||
it 'updates the user record' do
|
it 'updates the user record' do
|
||||||
put :update, params: { user: { locale: 'en', chosen_languages: ['es', 'fr', ''] } }
|
put :update, params: { user: { locale: 'en', chosen_languages: ['es', 'fr', ''] } }
|
||||||
|
|
||||||
expect(response).to redirect_to(settings_preferences_path)
|
expect(response).to redirect_to(settings_preferences_other_path)
|
||||||
user.reload
|
user.reload
|
||||||
expect(user.locale).to eq 'en'
|
expect(user.locale).to eq 'en'
|
||||||
expect(user.chosen_languages).to eq ['es', 'fr']
|
expect(user.chosen_languages).to eq ['es', 'fr']
|
||||||
|
@ -37,7 +37,7 @@ describe Settings::PreferencesController do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(response).to redirect_to(settings_preferences_path)
|
expect(response).to redirect_to(settings_preferences_other_path)
|
||||||
user.reload
|
user.reload
|
||||||
expect(user.settings['boost_modal']).to be true
|
expect(user.settings['boost_modal']).to be true
|
||||||
expect(user.settings['delete_modal']).to be false
|
expect(user.settings['delete_modal']).to be false
|
Reference in New Issue