fix: flow control in story creation

The various prompt-function callbacks get called on another thread,
meaning we can't wait for them to return to set the value. This moves
the flow control for story creation so it actually happens if you don't
have a default story type set
This commit is contained in:
Griffin Smith 2019-02-01 11:25:39 -05:00
parent a72382a77c
commit 0967cbcea6

View file

@ -595,21 +595,22 @@ If the stories already have a CLUBHOUSE-ID, they are filtered and ignored."
(when project-id
(org-clubhouse-prompt-for-epic
(lambda (epic-id)
(let ((selected-story-type org-clubhouse-default-story-type))
(if (not selected-story-type)
(org-clubhouse-prompt-for-story-type
(let ((create-story
(lambda (story-type)
(setq selected-story-type story-type)))
(-map (lambda (elt)
(let* ((title (plist-get elt :title))
(story (org-clubhouse-create-story-internal
title
:project-id project-id
:epic-id epic-id)))
(org-clubhouse-populate-created-story elt story)
(when (functionp then)
(funcall then story))))
new-elts))))))))))
(-map (lambda (elt)
(let* ((title (plist-get elt :title))
(story (org-clubhouse-create-story-internal
title
:project-id project-id
:epic-id epic-id
:story-type story-type)))
(org-clubhouse-populate-created-story elt story)
(when (functionp then)
(funcall then story))))
new-elts))))
(if org-clubhouse-default-story-type
(funcall create-story org-clubhouse-default-story-type)
(org-clubhouse-prompt-for-story-type create-story))))))))))
(defun org-clubhouse-create-story-with-task-list (&optional beg end)
"Creates a clubhouse story using the selected headline, making all direct