1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

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
parent 1b2d954d47
commit 90f8a7a36b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;
}
}