Skip to content

Commit 763c80b

Browse files
committed
guarding against unlikely race condition
1 parent cf87b97 commit 763c80b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

core/Controllers/WorkflowController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public async Task<IActionResult> Notifications(int since)
9494
public async Task<IActionResult> Create(PuckWorkflowItem model) {
9595
var success = false;
9696
var message = "";
97+
PuckWorkflowItem wfi = null;
9798
bool lockTaken = false;
9899
try
99100
{
@@ -118,6 +119,8 @@ public async Task<IActionResult> Create(PuckWorkflowItem model) {
118119
repo.AddPuckWorkflowItem(model);
119120
repo.SaveChanges();
120121

122+
wfi = model;
123+
121124
success = true;
122125
}
123126
catch (Exception ex)
@@ -130,7 +133,7 @@ public async Task<IActionResult> Create(PuckWorkflowItem model) {
130133
// slock1.Release();
131134
}
132135

133-
return Json(new {success=success,message=message });
136+
return Json(new {success=success,message=message,workflowItem=wfi });
134137
}
135138

136139
[HttpPost]

puckweb/wwwroot/Areas/puck/assets/js/puck.actions.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,14 @@ var displayMarkup = function (parentId, type, variant, fromVariant,contentId,con
12681268

12691269
var userObject = { username: userName, userRoles: userRoles, userGroups: userGroups };
12701270
var services = {
1271-
add: function (status, message, group, assignees, f) { addWorkflowItem(id, variant, status, "none", message, group, type, assignees, f || function () { }); },
1271+
add: function (status, message, group, assignees, f) {
1272+
addWorkflowItem(id, variant, status, "none", message, group, type, assignees, function (data) {
1273+
setTimeout(function () {
1274+
workflowItems[id + variant] = data.workflowItem;
1275+
},500);
1276+
if (f) f();
1277+
});
1278+
},
12721279
complete: function (status, f) { completeWorkflowItem(id, variant, status || "complete", f || function () { }); },
12731280
msg: msg
12741281
};

0 commit comments

Comments
 (0)