diff --git a/github-review.el b/github-review.el index 6528290..3a6fbf6 100644 --- a/github-review.el +++ b/github-review.el @@ -182,28 +182,36 @@ CALLBACK will be called back when done" (defun github-review-post-review-replies (pr-alist replies callback) "Submit replies to review comments inline." - (let-alist pr-alist - (-map - (lambda (comment) - (let* ((path (a-get comment 'path)) - (position (a-get comment 'position)) - (comment-id (alist-get (s-concat path - ":" - (number-to-string position)) - github-review-pos->databaseid - nil nil 'equal)) - (body (a-get comment 'body))) - (ghub-post (format "/repos/%s/%s/pulls/%s/comments/%s/replies" - .owner .repo .num comment-id) - nil - :payload (a-alist 'body body) - :headers github-review-diffheader - :auth 'github-review - :host (github-review-api-host pr-alist) - :callback (lambda (&rest _)) - :errorback #'github-review-errback))) - replies) - (funcall callback))) + (deferred:$ + (deferred:loop + replies + (lambda (comment) + (let-alist pr-alist + (let* ((path (a-get comment 'path)) + (position (a-get comment 'position)) + (comment-id (alist-get (s-concat path + ":" + (number-to-string position)) + github-review-pos->databaseid + nil nil 'equal)) + (body (a-get comment 'body))) + (ghub-post (format "/repos/%s/%s/pulls/%s/comments/%s/replies" + .owner .repo .num comment-id) + nil + :payload (a-alist 'body body) + :headers github-review-diffheader + :auth 'github-review + :host (github-review-api-host pr-alist) + :callback (lambda (&rest _)) + :errorback #'github-review-errback))))) + + (deferred:nextc it + (lambda (x) + (funcall callback))) + + (deferred:error it + (lambda (err) + (message "Got an error from the Github Reply API %S!" err))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Code review file parsing ;;