about summary refs log tree commit diff
path: root/org-clubhouse.el
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-02-01T16·25-0500
committerGriffin Smith <root@gws.fyi>2019-02-01T16·25-0500
commit0967cbcea6de5dccf0d8512dafd0331e6c836bbe (patch)
tree2b2a4f094b90718528e05d0a6b425d9cae7708f6 /org-clubhouse.el
parenta72382a77c81b6d79e201bb97f286f1e2aea411d (diff)
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
Diffstat (limited to 'org-clubhouse.el')
-rw-r--r--org-clubhouse.el29
1 files changed, 15 insertions, 14 deletions
diff --git a/org-clubhouse.el b/org-clubhouse.el
index 118997a9b202..442e73edeb3a 100644
--- a/org-clubhouse.el
+++ b/org-clubhouse.el
@@ -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