all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 63215@debbugs.gnu.org
Subject: [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email
Date: Tue, 02 May 2023 22:39:27 -0400	[thread overview]
Message-ID: <87y1m6yw80.fsf_-_@gmail.com> (raw)
In-Reply-To: <20230501225158.18612-3-arunisaac@systemreboot.net> (Arun Isaac's message of "Mon, 1 May 2023 23:51:58 +0100")

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> writes:

> * mumi/client.scm: Import (srfi srfi-1).
> (reply-email-headers): New function.
> (send-email): Call reply-email-headers.
> * tests/client.scm ("send patches to existing issue", "send single
> patch to existing issue"): Stub reply-email-headers.
> ("send patch to existing issue and Cc other participants"): New test.

Great series!

> ---
>  mumi/client.scm  | 35 +++++++++++++++++++++++++++++++----
>  tests/client.scm | 24 ++++++++++++++++++++++++
>  2 files changed, 55 insertions(+), 4 deletions(-)
>
> diff --git a/mumi/client.scm b/mumi/client.scm
> index 2750836..f0e4321 100644
> --- a/mumi/client.scm
> +++ b/mumi/client.scm
> @@ -18,6 +18,7 @@
>  
>  (define-module (mumi client)
>    #:use-module (rnrs io ports)
> +  #:use-module (srfi srfi-1)
>    #:use-module (srfi srfi-19)
>    #:use-module (srfi srfi-26)
>    #:use-module (srfi srfi-43)
> @@ -236,15 +237,41 @@ OPTIONS. Return the message ID of the first email sent."
>            (display (get-string-all port))
>            message-id)))))
>  
> +(define (reply-email-headers issue-number)
> +  "Return an association list of email headers when replying to
> +ISSUE-NUMBER."
> +  (let ((messages
> +         (assoc-ref
> +          (assoc-ref
> +           (graphql-http-get (graphql-endpoint)
> +                             `(document
> +                               (query (#(issue #:number ,issue-number)
> +                                       (messages (from name address)
> +                                                 date)))))
> +           "issue")
> +          "messages")))
> +    ;; When sending email to an issue, we Cc all issue participants.
> +    ;; TODO: Also add an In-Reply-To header.
> +    `((cc . ,(delete-duplicates
> +              (map (lambda (message)
> +                     (let ((from (assoc-ref message "from")))
> +                       (string-append (assoc-ref from "name")
> +                                      " <" (assoc-ref from "address") ">")))
> +                   (vector->list messages)))))))
> +
>  (define (send-email patches)
>    "Send PATCHES via email."
>    (if (current-issue-number)
>        ;; If an issue is current, send patches to that issue's email
>        ;; address.
> -      (git-send-email (string-append (number->string (current-issue-number))
> -                                     "@"
> -                                     (client-config 'debbugs-host))
> -                      patches)
> +      (let ((issue-number (current-issue-number)))
> +        (git-send-email (string-append (number->string issue-number)
> +                                       "@"
> +                                       (client-config 'debbugs-host))
> +                        patches
> +                        (map (cut string-append "--cc=" <>)
> +                             (assq-ref (reply-email-headers issue-number)
> +                                       'cc))))

I was thinking looking at this, with X-Debbugs-Cc headers now being
added automatically by Git for members of a team, there could be
duplication between X-Debbugs-Cc and the participannts retrieved from
the messages above.

To ensure participants do not receive duplicate replies, it'd be
probably best to stick to using X-Debbugs-Cc with all interactions with
Debbugs; this way a duplicate header is (hopefully) ignored by Debbugs
itself.

Does that make sense?

-- 
Thanks,
Maxim




  reply	other threads:[~2023-05-03  2:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 20:56 [bug#63215] [PATCH mumi 0/2] Cc all issue participants when sending email Arun Isaac
2023-05-01 21:01 ` [bug#63215] [PATCH mumi 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-01 21:01   ` [bug#63215] [PATCH mumi 2/2] client: Cc issue participants when sending email Arun Isaac
2023-05-01 22:51 ` [bug#63215] [PATCH v2 mumi 0/2] Cc all issue participants Arun Isaac
2023-05-01 22:51   ` [bug#63215] [PATCH v2 mumi 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-01 22:51   ` [bug#63215] [PATCH v2 mumi 2/2] client: Cc issue participants when sending email Arun Isaac
2023-05-03  2:39     ` Maxim Cournoyer [this message]
2023-05-05  2:00       ` [bug#63215] [PATCH mumi 0/2] Cc all " Arun Isaac
2023-05-05 13:24         ` Arun Isaac
2023-05-05 16:18           ` Maxim Cournoyer
2023-05-06 22:30             ` Arun Isaac
2023-05-07  2:27               ` Maxim Cournoyer
2023-05-07 11:27                 ` bug#63215: " Arun Isaac
2023-05-06 22:35 ` [bug#63215] [PATCH 1/2] client: Support passing options to git send-email Arun Isaac
2023-05-06 22:35   ` [bug#63215] [PATCH 2/2] client: Cc issue participants when sending email Arun Isaac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1m6yw80.fsf_-_@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=63215@debbugs.gnu.org \
    --cc=arunisaac@systemreboot.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.