Refactor user preferences, add defaults from file
* Turn prefs into a flat hash structure, since nesting is not worth the trouble * Add a custom serializer class for prefs * Add a config file for defaults and merge set prefs with unset ones * Use booleans for "true" and "false", and integers where appropriate
This commit is contained in:
@@ -8,13 +8,11 @@
|
||||
description: "Notify me when sats are sent to my Lightning Address"
|
||||
) do %>
|
||||
<% f.fields_for :preferences do |p| %>
|
||||
<% p.fields_for :lightning do |l| %>
|
||||
<%= l.select :notify_sats_received, options_for_select([
|
||||
["off", "off"],
|
||||
["Chat (Jabber)", "xmpp"],
|
||||
["E-Mail", "email"]
|
||||
], selected: @user.preferences.dig('lightning', 'notify_sats_received')) %>
|
||||
<% end %>
|
||||
<%= p.select :lightning_notify_sats_received, options_for_select([
|
||||
["off", "disabled"],
|
||||
["Chat (Jabber)", "xmpp"],
|
||||
["E-Mail", "email"]
|
||||
], selected: @user.preferences[:lightning_notify_sats_received]) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<h3>Contacts</h3>
|
||||
<ul role="list">
|
||||
<%= render FormElements::FieldsetToggleComponent.new(
|
||||
field_name: "user[preferences][xmpp][exchange_contacts_with_invitees]",
|
||||
enabled: @user.pref_enabled?("xmpp:exchange_contacts_with_invitees"),
|
||||
field_name: "user[preferences][xmpp_exchange_contacts_with_invitees]",
|
||||
enabled: @user.preferences[:xmpp_exchange_contacts_with_invitees],
|
||||
title: "Exchange contacts when invited user signs up",
|
||||
description: "Add each others contacts, so you can chat with them immediately"
|
||||
) %>
|
||||
|
||||
Reference in New Issue
Block a user