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
|
@ -20,20 +20,22 @@ describe Settings::Preferences::NotificationsController do
|
|||
|
||||
describe 'PUT #update' do
|
||||
it 'updates notifications settings' do
|
||||
user.settings['notification_emails'] = user.settings['notification_emails'].merge('follow' => false)
|
||||
user.settings['interactions'] = user.settings['interactions'].merge('must_be_follower' => true)
|
||||
user.settings.update('notification_emails.follow': false, 'interactions.must_be_follower': true)
|
||||
user.save
|
||||
|
||||
put :update, params: {
|
||||
user: {
|
||||
notification_emails: { follow: '1' },
|
||||
interactions: { must_be_follower: '0' },
|
||||
settings_attributes: {
|
||||
'notification_emails.follow': '1',
|
||||
'interactions.must_be_follower': '0',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(settings_preferences_notifications_path)
|
||||
user.reload
|
||||
expect(user.settings['notification_emails']['follow']).to be true
|
||||
expect(user.settings['interactions']['must_be_follower']).to be false
|
||||
expect(user.settings['notification_emails.follow']).to be true
|
||||
expect(user.settings['interactions.must_be_follower']).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue