You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pre-MongoDB, when an organization was updated by removing a project from it, the application handled removing organizationId refs and updating the projectId list for the organization. That code has not been re-added in OrganizationController#updateOrganization, so this needs to be addressed. Below is the commented out code that has been removed for now.
// FIXME: Add back in hook after organization is updated.
JsonNode projects = entry.getValue();
Collection<Project> projectsToInsert = new ArrayList<>(projects.size());
Collection<Project> existingProjects = org.projects();
// set projects orgId for all valid projects in list
for (JsonNode project : projects) {
if (!project.has("id")) {
halt(400, "Project not supplied");
}
Project p = Project.retrieve(project.get("id").asText());
if (p == null) {
halt(404, "Project not found");
}
Organization previousOrg = p.retrieveOrganization();
if (previousOrg != null && !previousOrg.id.equals(org.id)) {
halt(400, SparkUtils.formatJSON(String.format("Project %s cannot be reassigned while belonging to org %s", p.id, previousOrg.id), 400));
}
projectsToInsert.add(p);
p.organizationId = org.id;
p.save();
}
// assign remaining previously assigned projects to null
existingProjects.removeAll(projectsToInsert);
for (Project p : existingProjects) {
p.organizationId = null;
p.save();
}
The text was updated successfully, but these errors were encountered:
Pre-MongoDB, when an organization was updated by removing a project from it, the application handled removing
organizationId
refs and updating the projectId list for the organization. That code has not been re-added inOrganizationController#updateOrganization
, so this needs to be addressed. Below is the commented out code that has been removed for now.The text was updated successfully, but these errors were encountered: