Merge pull request #4275 from acarl005/master
fix: prevent persistent workspaces from being duplicated if they exist…
This commit is contained in:
@ -65,11 +65,15 @@ Json::Value Workspaces::createMonitorWorkspaceData(std::string const &name,
|
||||
void Workspaces::createWorkspace(Json::Value const &workspace_data,
|
||||
Json::Value const &clients_data) {
|
||||
auto workspaceName = workspace_data["name"].asString();
|
||||
auto workspaceId = workspace_data["id"].asInt();
|
||||
spdlog::debug("Creating workspace {}", workspaceName);
|
||||
|
||||
// avoid recreating existing workspaces
|
||||
auto workspace =
|
||||
std::ranges::find_if(m_workspaces, [workspaceName](std::unique_ptr<Workspace> const &w) {
|
||||
std::ranges::find_if(m_workspaces, [&](std::unique_ptr<Workspace> const &w) {
|
||||
if (workspaceId > 0) {
|
||||
return w->id() == workspaceId;
|
||||
}
|
||||
return (workspaceName.starts_with("special:") && workspaceName.substr(8) == w->name()) ||
|
||||
workspaceName == w->name();
|
||||
});
|
||||
|
Reference in New Issue
Block a user