fix: 409 conflicts resolution in notifications (#13900)

* fix: 409 conflicts resolution in notifications

* fix: silently log other http errors

* fix: pass force push flag to start_sync_user_preset

* remove formatting churn

* fix: propagate force push down put_setting

* refactor render_hyperlink_action to PopNotification for reuse

* fix an issue that hold status should be cleared before force pushing.

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ian Chua
2026-05-31 16:23:10 +08:00
committed by GitHub
parent 6a26284ba6
commit 535911fcfe
11 changed files with 259 additions and 86 deletions

View File

@@ -297,6 +297,7 @@ private:
NetworkAgent* m_agent { nullptr };
std::map<std::string, std::string> need_delete_presets; // store setting ids of preset
std::vector<bool> m_create_preset_blocked { false, false, false, false, false, false }; // excceed limit
std::vector<std::string> m_pending_conflict_setting_ids; // setting_id from the most recent 409 conflict
bool m_networking_compatible { false };
bool m_networking_need_update { false };
bool m_networking_cancel_update { false };
@@ -322,6 +323,7 @@ private:
boost::thread m_sync_update_thread;
std::shared_ptr<int> m_user_sync_token;
std::atomic<bool> m_restart_sync_pending {false};
std::atomic<bool> m_sync_user_presets_now {false}; // request the sync loop to push user presets on its next tick
bool m_is_dark_mode{ false };
bool m_adding_script_handler { false };
bool m_side_popup_status{false};
@@ -529,10 +531,13 @@ public:
void add_pending_vendor_preset(const std::pair<std::string, std::map<std::string, std::string>>& preset_data);
void load_pending_vendors();
void sync_preset(Preset* preset);
void sync_preset(Preset* preset, bool force = false);
void start_sync_user_preset(bool with_progress_dlg = false);
void stop_sync_user_preset();
void restart_sync_user_preset();
// Resolve a cloud sync 409 by force-pushing the conflicting preset: clears the "hold"
// state the conflict left behind and queues it to be re-uploaded with force=true.
void force_push_conflicting_preset(const std::string& setting_id);
void on_stealth_mode_enter();
// Bundle subscription sync