Change user settings to be stored in a more optimal way (#23630)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
e7c3e55874
commit
a9b5598c97
36 changed files with 817 additions and 525 deletions
|
@ -88,21 +88,19 @@ describe ApplicationController, type: :controller do
|
|||
|
||||
it 'returns instances\'s default theme when user didn\'t set theme' do
|
||||
current_user = Fabricate(:user)
|
||||
current_user.settings.update(theme: 'contrast', noindex: false)
|
||||
current_user.save
|
||||
sign_in current_user
|
||||
|
||||
allow(Setting).to receive(:[]).with('theme').and_return 'contrast'
|
||||
allow(Setting).to receive(:[]).with('noindex').and_return false
|
||||
|
||||
expect(controller.view_context.current_theme).to eq 'contrast'
|
||||
end
|
||||
|
||||
it 'returns user\'s theme when it is set' do
|
||||
current_user = Fabricate(:user)
|
||||
current_user.settings['theme'] = 'mastodon-light'
|
||||
current_user.settings.update(theme: 'mastodon-light')
|
||||
current_user.save
|
||||
sign_in current_user
|
||||
|
||||
allow(Setting).to receive(:[]).with('theme').and_return 'contrast'
|
||||
|
||||
expect(controller.view_context.current_theme).to eq 'mastodon-light'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue