Fix bug when saving user preferences theme

it was being saved even when it should have been empty value
This commit is contained in:
Lance Edgar 2024-04-25 23:56:21 -05:00
parent 8b3a9c9dad
commit ba32422059

View file

@ -612,14 +612,25 @@ class UserView(PrincipalMasterView):
# display # display
{'section': f'tailbone.{user.uuid}', {'section': f'tailbone.{user.uuid}',
'option': 'user_css', 'option': 'user_css',
'value': user_css}, 'value': user_css,
'save_if_empty': False},
] ]
def preferences_gather_settings(self, data, user): def preferences_gather_settings(self, data, user):
simple_settings = self.preferences_get_simple_settings(user) simple_settings = self.preferences_get_simple_settings(user)
return self.configure_gather_settings( settings = self.configure_gather_settings(
data, simple_settings=simple_settings, input_file_templates=False) data, simple_settings=simple_settings, input_file_templates=False)
# TODO: ugh why does user_css come back as 'default' instead of None?
final_settings = []
for setting in settings:
if setting['name'].endswith('.user_css'):
if setting['value'] == 'default':
continue
final_settings.append(setting)
return final_settings
def preferences_remove_settings(self, user): def preferences_remove_settings(self, user):
app = self.get_rattail_app() app = self.get_rattail_app()
simple_settings = self.preferences_get_simple_settings(user) simple_settings = self.preferences_get_simple_settings(user)