From 4b7ee02a150f687ea4716ab0a28dacaf3febc804 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 22 Dec 2024 13:27:50 +0100 Subject: [PATCH] updae org-jira Signed-off-by: Andreas Gerler --- elpa/org-jira-20230915.57/org-jira-pkg.el | 15 ------ .../jiralib.el | 18 ++++++- .../org-jira-autoloads.el | 20 +++---- elpa/org-jira-20240928.2340/org-jira-pkg.el | 12 +++++ .../org-jira-sdk.el | 1 - .../org-jira.el | 53 +++++++++++++++++-- 6 files changed, 89 insertions(+), 30 deletions(-) delete mode 100644 elpa/org-jira-20230915.57/org-jira-pkg.el rename elpa/{org-jira-20230915.57 => org-jira-20240928.2340}/jiralib.el (98%) rename elpa/{org-jira-20230915.57 => org-jira-20240928.2340}/org-jira-autoloads.el (93%) create mode 100644 elpa/org-jira-20240928.2340/org-jira-pkg.el rename elpa/{org-jira-20230915.57 => org-jira-20240928.2340}/org-jira-sdk.el (99%) rename elpa/{org-jira-20230915.57 => org-jira-20240928.2340}/org-jira.el (98%) diff --git a/elpa/org-jira-20230915.57/org-jira-pkg.el b/elpa/org-jira-20230915.57/org-jira-pkg.el deleted file mode 100644 index bbda076e..00000000 --- a/elpa/org-jira-20230915.57/org-jira-pkg.el +++ /dev/null @@ -1,15 +0,0 @@ -(define-package "org-jira" "20230915.57" "Syncing between Jira and Org-mode." - '((emacs "24.5") - (cl-lib "0.5") - (request "0.2.0") - (dash "2.14.1")) - :commit "295b01ede42952c848bd8d76bc8c456a87876cbc" :maintainers - '(("Matthew Carter" . "m@ahungry.com")) - :maintainer - '("Matthew Carter" . "m@ahungry.com") - :keywords - '("ahungry" "jira" "org" "bug" "tracker") - :url "https://github.com/ahungry/org-jira") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/org-jira-20230915.57/jiralib.el b/elpa/org-jira-20240928.2340/jiralib.el similarity index 98% rename from elpa/org-jira-20230915.57/jiralib.el rename to elpa/org-jira-20240928.2340/jiralib.el index 4c1907b3..23d4204d 100644 --- a/elpa/org-jira-20230915.57/jiralib.el +++ b/elpa/org-jira-20240928.2340/jiralib.el @@ -15,7 +15,6 @@ ;; Alex Harsanyi ;; Maintainer: Matthew Carter -;; Version: 3.0.0 ;; Homepage: https://github.com/ahungry/org-jira ;; This file is not part of GNU Emacs. @@ -472,7 +471,8 @@ request.el, so if at all possible, it should be avoided." ('updateIssue (jiralib--rest-call-it (format "/rest/api/2/issue/%s" (first params)) :type "PUT" - :data (json-encode `((fields . ,(second params))))))))) + :data (json-encode `((fields . ,(second params)))))) + ('getLabels (jiralib--rest-call-it (format "/rest/api/2/label?startAt=%s" (first params))))))) (defun jiralib--soap-call-it (&rest args) "Deprecated SOAP call endpoint. Will be removed soon. @@ -1202,6 +1202,20 @@ Auxiliary Notes: (apply 'jiralib-call "getIssuesFromBoard" (cl-getf params :callback) board-id params)) +(defvar jiralib-labels-cache nil) +(defun jiralib-get-labels () + "Return assignable labels that can be added to an issue." + (unless jiralib-labels-cache + (setq jiralib-labels-start-at 0) + (while (progn + (let* ((labels (jiralib-call "getLabels" nil jiralib-labels-start-at)) + (max-results (alist-get 'maxResults labels)) + (is-last (alist-get 'isLast labels)) + (values (alist-get 'values labels))) + (setq jiralib-labels-start-at (+ max-results jiralib-labels-start-at) + jiralib-labels-cache (append values jiralib-labels-cache)) + (not (eq is-last t))))))) + (defun jiralib--agile-not-last-entry (num-entries total start-at limit) "Return true if need to retrieve next page from agile api" (and (> num-entries 0) diff --git a/elpa/org-jira-20230915.57/org-jira-autoloads.el b/elpa/org-jira-20240928.2340/org-jira-autoloads.el similarity index 93% rename from elpa/org-jira-20230915.57/org-jira-autoloads.el rename to elpa/org-jira-20240928.2340/org-jira-autoloads.el index cf50172b..7a4569a2 100644 --- a/elpa/org-jira-20230915.57/org-jira-autoloads.el +++ b/elpa/org-jira-20240928.2340/org-jira-autoloads.el @@ -28,19 +28,19 @@ Commands: Entry to this mode calls the value of `org-jira-mode-hook'. -This is a minor mode. If called interactively, toggle the -`Org-jira mode' mode. If the prefix argument is positive, enable -the mode, and if it is zero or negative, disable the mode. +This is a minor mode. If called interactively, toggle the `Org-jira +mode' mode. If the prefix argument is positive, enable the mode, and if +it is zero or negative, disable the mode. -If called from Lisp, toggle the mode if ARG is `toggle'. Enable -the mode if ARG is nil, omitted, or is a positive number. -Disable the mode if ARG is a negative number. +If called from Lisp, toggle the mode if ARG is `toggle'. Enable the +mode if ARG is nil, omitted, or is a positive number. Disable the mode +if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, -evaluate `org-jira-mode'. +evaluate the variable `org-jira-mode'. -The mode's hook is called both when the mode is enabled and when -it is disabled. +The mode's hook is called both when the mode is enabled and when it is +disabled. (fn &optional ARG)" t) (autoload 'org-jira-get-projects "org-jira" "\ @@ -116,6 +116,8 @@ Update an issue." t) Convert an ordinary todo item to a jira ticket." t) (autoload 'org-jira-get-subtasks "org-jira" "\ Get subtasks for the current issue." t) +(autoload 'org-jira-update-issue-labels "org-jira" "\ +Update jira issue labels." t) (autoload 'org-jira-create-issue "org-jira" "\ Create an issue in PROJECT, of type TYPE, with given SUMMARY and DESCRIPTION. diff --git a/elpa/org-jira-20240928.2340/org-jira-pkg.el b/elpa/org-jira-20240928.2340/org-jira-pkg.el new file mode 100644 index 00000000..1dd0f168 --- /dev/null +++ b/elpa/org-jira-20240928.2340/org-jira-pkg.el @@ -0,0 +1,12 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "org-jira" "20240928.2340" + "Syncing between Jira and Org-mode." + '((emacs "24.5") + (cl-lib "0.5") + (request "0.2.0") + (dash "2.14.1")) + :url "https://github.com/ahungry/org-jira" + :commit "5f591f5f4abd0ef12c64676e38d8ec3b13eba280" + :revdesc "5f591f5f4abd" + :keywords '("ahungry" "jira" "org" "bug" "tracker") + :maintainers '(("Matthew Carter" . "m@ahungry.com"))) diff --git a/elpa/org-jira-20230915.57/org-jira-sdk.el b/elpa/org-jira-20240928.2340/org-jira-sdk.el similarity index 99% rename from elpa/org-jira-20230915.57/org-jira-sdk.el rename to elpa/org-jira-20240928.2340/org-jira-sdk.el index 864de376..49032f50 100644 --- a/elpa/org-jira-20230915.57/org-jira-sdk.el +++ b/elpa/org-jira-20240928.2340/org-jira-sdk.el @@ -7,7 +7,6 @@ ;; ;; Maintainer: Matthew Carter ;; URL: https://github.com/ahungry/org-jira -;; Version: 3.1.1 ;; Keywords: ahungry jira org bug tracker ;; Package-Requires: ((emacs "24.5") (cl-lib "0.5") (request "0.2.0") (s "0.0.0")) diff --git a/elpa/org-jira-20230915.57/org-jira.el b/elpa/org-jira-20240928.2340/org-jira.el similarity index 98% rename from elpa/org-jira-20230915.57/org-jira.el rename to elpa/org-jira-20240928.2340/org-jira.el index 0f45c414..6bb4a2a7 100644 --- a/elpa/org-jira-20230915.57/org-jira.el +++ b/elpa/org-jira-20240928.2340/org-jira.el @@ -9,7 +9,8 @@ ;; ;; Maintainer: Matthew Carter ;; URL: https://github.com/ahungry/org-jira -;; Version: 4.3.3 +;; Package-Version: 20240928.2340 +;; Package-Revision: 5f591f5f4abd ;; Keywords: ahungry jira org bug tracker ;; Package-Requires: ((emacs "24.5") (cl-lib "0.5") (request "0.2.0") (dash "2.14.1")) @@ -38,6 +39,9 @@ ;;; News: +;;;; Changes in 4.4.2 +;; - Fix for org-insert-subheading behavior change in org 9.7+ in render-issues + ;;;; Changes in 4.4.1 ;; - Fix tag (4.3.3 was out of order - we had a 4.4.0 on repo) ;; - Fix for some crazy scoping issue in the org-jira-get-issue-val-from-org function @@ -136,7 +140,7 @@ (require 'jiralib) (require 'org-jira-sdk) -(defconst org-jira-version "4.3.1" +(defconst org-jira-version "4.4.2" "Current version of org-jira.el.") (defgroup org-jira nil @@ -329,6 +333,11 @@ See `org-default-priority' for more info." :group 'org-jira :type 'boolean) +(defcustom org-jira-update-issue-details-include-reporter t + "For Jira Cloud API we will get an error if `reporter' is sent with an update request." + :group 'org-jira + :type 'string) + (defvar org-jira-serv nil "Parameters of the currently selected blog.") @@ -545,6 +554,7 @@ See `org-default-priority' for more info." (define-key org-jira-map (kbd "C-c ih") 'org-jira-get-issues-headonly) ;;(define-key org-jira-map (kbd "C-c if") 'org-jira-get-issues-from-filter-headonly) ;;(define-key org-jira-map (kbd "C-c iF") 'org-jira-get-issues-from-filter) + (define-key org-jira-map (kbd "C-c il") 'org-jira-update-issue-labels) (define-key org-jira-map (kbd "C-c iu") 'org-jira-update-issue) (define-key org-jira-map (kbd "C-c iw") 'org-jira-progress-issue) (define-key org-jira-map (kbd "C-c in") 'org-jira-progress-issue-next) @@ -1172,6 +1182,7 @@ ORG-JIRA-PROJ-KEY-OVERRIDE being set before and after running." (if (org-goto-first-child) (org-insert-heading) (goto-char (point-max)) + (open-line 1) (org-insert-subheading t)) (org-jira-insert entry-heading "\n")) @@ -1681,6 +1692,16 @@ purpose of wiping an old subtree." (ensure-on-issue (org-jira-get-issues-headonly (jiralib-do-jql-search (format "parent = %s" (org-jira-parse-issue-id)))))) +;;;###autoload +(defun org-jira-update-issue-labels () + "Update jira issue labels." + (interactive) + (let* ((labels (org-jira-parse-issue-labels)) + (updated-labels (org-jira-read-labels (format "%s, " labels))) + (updated-labels-string (mapconcat 'identity updated-labels ", "))) + (org-set-property "labels" updated-labels-string) + (org-jira-update-issue))) + (defvar org-jira-project-read-history nil) (defvar org-jira-boards-read-history nil) (defvar org-jira-sprints-read-history nil) @@ -1798,6 +1819,7 @@ that should be bound to an issue." (jira-users (org-jira-get-assignable-users project)) (user (completing-read "Assignee: " (mapcar 'car jira-users))) (priority (car (rassoc (org-jira-read-priority) (jiralib-get-priorities)))) + (labels (org-jira-read-labels)) (ticket-struct `((fields (project (key . ,project)) @@ -1811,6 +1833,7 @@ that should be bound to an issue." ""))) (description . ,description) (priority (id . ,priority)) + (labels . ,labels) ;; accountId should be nil if Unassigned, not the key slot. (assignee (accountId . ,(or (cdr (assoc user jira-users)) nil))))))) ticket-struct)) @@ -1917,6 +1940,15 @@ that should be bound to an issue." (car (rassoc action actions)) (user-error "You specified an empty action, the valid actions are: %s" (mapcar 'cdr actions))))) +(defun org-jira-read-labels (&optional current-labels) + "Pick multiple labels which will be added or updating existing +CURRENT-LABELS and save with the jira issue." + (unless current-labels (setq current-labels nil)) + (if jiralib-labels-cache + (completing-read-multiple "Labels: " jiralib-labels-cache nil nil current-labels) + (jiralib-get-labels) + (completing-read-multiple "Labels: " jiralib-labels-cache nil nil current-labels))) + (defvar org-jira-fields-history nil) (defun org-jira-read-field (fields) "Read (custom) FIELDS for workflow progress." @@ -2213,11 +2245,14 @@ otherwise it should return: (jiralib-get-priorities))) (cons 'description org-issue-description) (cons 'assignee (list (cons 'id (jiralib-get-user-account-id project org-issue-assignee)))) - (cons 'reporter (list (cons 'id (jiralib-get-user-account-id project org-issue-reporter)))) (cons 'summary (org-jira-strip-priority-tags (org-jira-get-issue-val-from-org 'summary))) (cons 'issuetype `((id . ,org-issue-type-id) (name . ,org-issue-type)))))) + (if org-jira-update-issue-details-include-reporter + (setq update-fields + (append update-fields + (list (cons 'reporter (list (cons 'id (jiralib-get-user-account-id project org-issue-reporter)))))))) ;; If we enable duedate sync and we have a deadline present (when (and org-jira-deadline-duedate-sync-p @@ -2270,6 +2305,18 @@ otherwise it should return: (setq continue nil))) filename))) +(defun org-jira-parse-issue-labels () + "Get issue labels from org text." + (save-excursion + (let ((continue t) + labels) + (while continue + (when (setq labels (org-entry-get (point) "labels")) + (setq continue nil)) + (unless (and continue (org-up-heading-safe)) + (setq continue nil))) + labels))) + (defun org-jira-get-from-org (type entry) "Get an org property from the current item. -- 2.47.3