mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 02:18:10 +01:00
Fix enable/disable Update notification settings.
This commit is contained in:
@@ -11269,6 +11269,16 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
||||
settings_copy["notifications_outgoing_transactions"] = new_value
|
||||
settings_changed = True
|
||||
|
||||
if "notifications_swap_completed" in data:
|
||||
new_value = data["notifications_swap_completed"]
|
||||
ensure(
|
||||
isinstance(new_value, bool),
|
||||
"New notifications_swap_completed value not boolean",
|
||||
)
|
||||
if settings_copy.get("notifications_swap_completed", True) != new_value:
|
||||
settings_copy["notifications_swap_completed"] = new_value
|
||||
settings_changed = True
|
||||
|
||||
if "notifications_duration" in data:
|
||||
new_value = data["notifications_duration"]
|
||||
ensure(
|
||||
@@ -11283,6 +11293,15 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
||||
settings_copy["notifications_duration"] = new_value
|
||||
settings_changed = True
|
||||
|
||||
if "check_updates" in data:
|
||||
new_value = data["check_updates"]
|
||||
ensure(
|
||||
isinstance(new_value, bool), "New check_updates value not boolean"
|
||||
)
|
||||
if settings_copy.get("check_updates", True) != new_value:
|
||||
settings_copy["check_updates"] = new_value
|
||||
settings_changed = True
|
||||
|
||||
if settings_changed:
|
||||
settings_path = os.path.join(self.data_dir, cfg.CONFIG_FILENAME)
|
||||
settings_path_new = settings_path + ".new"
|
||||
|
||||
@@ -492,7 +492,7 @@
|
||||
|
||||
<div class="py-2">
|
||||
<div class="flex items-center">
|
||||
<input type="checkbox" id="check_updates" name="check_updates" value="true" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-600 dark:border-gray-500"{% if general_settings.check_updates %} checked{% endif %}>
|
||||
<input type="checkbox" id="check_updates" name="check_updates" value="true" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-600 dark:border-gray-500"{% if notification_settings.check_updates %} checked{% endif %}>
|
||||
<label for="check_updates" class="ml-3 text-sm font-medium text-gray-700 dark:text-gray-300">Update Notifications</label>
|
||||
<button type="button" data-check-updates class="ml-3 text-xs bg-gray-600 hover:bg-gray-700 text-white font-medium py-1 px-3 rounded transition-colors focus:outline-none">
|
||||
Check Now
|
||||
|
||||
@@ -92,7 +92,7 @@ def page_settings(self, url_split, post_string):
|
||||
get_data_entry_or(form_data, "notifications_duration", "20")
|
||||
),
|
||||
"check_updates": toBool(
|
||||
get_data_entry_or(form_data, "check_updates", "true")
|
||||
get_data_entry_or(form_data, "check_updates", "false")
|
||||
),
|
||||
}
|
||||
swap_client.editGeneralSettings(data)
|
||||
@@ -242,6 +242,7 @@ def page_settings(self, url_split, post_string):
|
||||
"notifications_duration": swap_client.settings.get(
|
||||
"notifications_duration", 20
|
||||
),
|
||||
"check_updates": swap_client.settings.get("check_updates", True),
|
||||
}
|
||||
|
||||
tor_control_password = (
|
||||
|
||||
Reference in New Issue
Block a user