Browser: Make removal of bookmark persistent (#1865)

Json model wasn't stored after bookmark removal.
Store the model if remove() was successful.
This commit is contained in:
Vojtech Moravec 2020-04-19 14:43:16 +02:00 committed by GitHub
commit 90f8a7a36b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-19 07:28:32 +09:00

View file

@ -184,8 +184,12 @@ bool BookmarksBarWidget::remove_bookmark(const String& url)
auto item_url = model()->data(model()->index(item_index, 1)).to_string();
if (item_url == url) {
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
json_model.remove(item_index);
return true;
const auto item_removed = json_model.remove(item_index);
if (item_removed)
json_model.store();
return item_removed;
}
}