From 255ffd06e6a6f8a50aa0ff5e1c0ee1e73b0fef28 Mon Sep 17 00:00:00 2001 From: Doris Lam Date: Mon, 4 Mar 2024 10:16:55 -0800 Subject: [PATCH] set appropriate status if branching from commit --- .../openmbee/mms/crud/services/DefaultBranchService.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crud/src/main/java/org/openmbee/mms/crud/services/DefaultBranchService.java b/crud/src/main/java/org/openmbee/mms/crud/services/DefaultBranchService.java index 7abc363f1..0945aa916 100644 --- a/crud/src/main/java/org/openmbee/mms/crud/services/DefaultBranchService.java +++ b/crud/src/main/java/org/openmbee/mms/crud/services/DefaultBranchService.java @@ -136,9 +136,8 @@ public RefJson createBranch(String projectId, RefJson branch) { branch.setCreated(Formats.FORMATTER.format(now)); branch.setDeleted(false); branch.setProjectId(projectId); - branch.setStatus("created"); boolean fromCommit = branch.getParentCommitId() == null ? false : true; - + branch.setStatus(fromCommit ? "creating" : "created"); if (branch.getDocId() == null || branch.getDocId().isEmpty()) { String docId = branchIndex.createDocId(branch); branch.setDocId(docId); @@ -222,7 +221,6 @@ public RefJson createBranchfromCommit(String projectId, RefJson parentCommitIdRe ContextHolder.setContext(projectId, parentRef); RefJson branchFromCommit = this.createBranch(projectId, parentCommitIdRef); - ContextHolder.setContext(projectId, branchFromCommit.getId()); // Get current nodes from database @@ -249,7 +247,8 @@ public RefJson createBranchfromCommit(String projectId, RefJson parentCommitIdRe } } nodeRepository.updateAll(nodes); - + branchFromCommit.setStatus("created"); + branchIndex.update(branchFromCommit); try { nodeIndex.addToRef(docIds); } catch(Exception e) {} return branchFromCommit;