feat: Populate description when creating stories
If a DESCRIPTION drawer exists on headlines being used to create stories, it is populated as the description of the created story
This commit is contained in:
parent
627799d4dc
commit
3fc1a3445b
1 changed files with 25 additions and 17 deletions
|
@ -239,9 +239,10 @@ not be prompted")
|
||||||
(append elt `(:children ,(reverse children)))))
|
(append elt `(:children ,(reverse children)))))
|
||||||
|
|
||||||
(defun +org-element-contents (elt)
|
(defun +org-element-contents (elt)
|
||||||
(buffer-substring-no-properties
|
(if-let ((begin (plist-get (cadr elt) :contents-begin))
|
||||||
(plist-get (cadr elt) :contents-begin)
|
(end (plist-get (cadr elt) :contents-end)))
|
||||||
(plist-get (cadr elt) :contents-end)))
|
(buffer-substring-no-properties begin end)
|
||||||
|
""))
|
||||||
|
|
||||||
(defun org-clubhouse-find-description-drawer ()
|
(defun org-clubhouse-find-description-drawer ()
|
||||||
"Try to find a DESCRIPTION drawer in the current element."
|
"Try to find a DESCRIPTION drawer in the current element."
|
||||||
|
@ -557,15 +558,17 @@ If the epics already have a CLUBHOUSE-EPIC-ID, they are filtered and ignored."
|
||||||
(alist-get-equal org-clubhouse-default-state (org-clubhouse-workflow-states)))
|
(alist-get-equal org-clubhouse-default-state (org-clubhouse-workflow-states)))
|
||||||
|
|
||||||
(cl-defun org-clubhouse-create-story-internal
|
(cl-defun org-clubhouse-create-story-internal
|
||||||
(title &key project-id epic-id story-type)
|
(title &key project-id epic-id story-type description)
|
||||||
(assert (and (stringp title)
|
(assert (and (stringp title)
|
||||||
(integerp project-id)
|
(integerp project-id)
|
||||||
(or (null epic-id) (integerp epic-id))))
|
(or (null epic-id) (integerp epic-id))
|
||||||
|
(or (null description) (stringp description))))
|
||||||
(let ((workflow-state-id (org-clubhouse-default-state-id))
|
(let ((workflow-state-id (org-clubhouse-default-state-id))
|
||||||
(params `((name . ,title)
|
(params `((name . ,title)
|
||||||
(project_id . ,project-id)
|
(project_id . ,project-id)
|
||||||
(epic_id . ,epic-id)
|
(epic_id . ,epic-id)
|
||||||
(story_type . ,story-type))))
|
(story_type . ,story-type)
|
||||||
|
(description . ,description))))
|
||||||
|
|
||||||
(when workflow-state-id
|
(when workflow-state-id
|
||||||
(push `(workflow_state_id . ,workflow-state-id) params))
|
(push `(workflow_state_id . ,workflow-state-id) params))
|
||||||
|
@ -627,13 +630,18 @@ If the stories already have a CLUBHOUSE-ID, they are filtered and ignored."
|
||||||
(lambda (epic-id)
|
(lambda (epic-id)
|
||||||
(let ((create-story
|
(let ((create-story
|
||||||
(lambda (story-type)
|
(lambda (story-type)
|
||||||
(-map (lambda (elt)
|
(-map
|
||||||
|
(lambda (elt)
|
||||||
(let* ((title (plist-get elt :title))
|
(let* ((title (plist-get elt :title))
|
||||||
(story (org-clubhouse-create-story-internal
|
(story (org-clubhouse-create-story-internal
|
||||||
title
|
title
|
||||||
:project-id project-id
|
:project-id project-id
|
||||||
:epic-id epic-id
|
:epic-id epic-id
|
||||||
:story-type story-type)))
|
:story-type story-type))
|
||||||
|
(description
|
||||||
|
(save-mark-and-excursion
|
||||||
|
(goto-char (plist-get elt :begin))
|
||||||
|
(org-clubhouse-find-description-drawer))))
|
||||||
(org-clubhouse-populate-created-story elt story)
|
(org-clubhouse-populate-created-story elt story)
|
||||||
(when (functionp then)
|
(when (functionp then)
|
||||||
(funcall then story))))
|
(funcall then story))))
|
||||||
|
|
Loading…
Reference in a new issue