GNU bug report logs - #63215
[PATCH mumi 0/2] Cc all issue participants when sending email

Previous Next

Package: mumi;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Mon, 1 May 2023 20:58:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 63215 <at> 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
Hi Arun,

Arun Isaac <arunisaac <at> 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




This bug report was last modified 1 year and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.