Skip to content
Snippets Groups Projects
Verified Commit c8944219 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Simplify using erase_if

parent cfdf5e28
No related branches found
No related tags found
No related merge requests found
...@@ -200,34 +200,26 @@ from_json(const json &obj, DeviceLists &device_lists) ...@@ -200,34 +200,26 @@ from_json(const json &obj, DeviceLists &device_lists)
if (obj.count("changed") != 0) { if (obj.count("changed") != 0) {
device_lists.changed = obj.at("changed").get<std::vector<std::string>>(); device_lists.changed = obj.at("changed").get<std::vector<std::string>>();
device_lists.changed.erase( std::erase_if(device_lists.changed, [](const std::string &user) {
std::remove_if(device_lists.changed.begin(), if (user.size() > 255) {
device_lists.changed.end(), mtx::utils::log::log()->warn("Invalid userid in device list changed.");
[](const std::string &user) { return true;
if (user.size() > 255) { } else
mtx::utils::log::log()->warn( return false;
"Invalid userid in device list changed."); });
return true;
} else
return false;
}),
device_lists.changed.end());
} }
if (obj.count("left") != 0) { if (obj.count("left") != 0) {
device_lists.left = obj.at("left").get<std::vector<std::string>>(); device_lists.left = obj.at("left").get<std::vector<std::string>>();
device_lists.left.erase(std::remove_if(device_lists.left.begin(), std::erase_if(device_lists.left, [](const std::string &user) {
device_lists.left.end(), if (user.size() > 255) {
[](const std::string &user) { mtx::utils::log::log()->warn(
if (user.size() > 255) { "Invalid userid in device list left.");
mtx::utils::log::log()->warn( return true;
"Invalid userid in device list left."); } else
return true; return false;
} else });
return false;
}),
device_lists.left.end());
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment