Blame SOURCES/0088-bugzilla-add-comment-to-closed-bugs-too.patch

4b6aa8
From 9a03b1ede8320c7cd82a1093f620ebcf4c3efb3d Mon Sep 17 00:00:00 2001
4b6aa8
From: Jakub Filak <jfilak@redhat.com>
4b6aa8
Date: Fri, 26 Sep 2014 19:56:28 +0200
4b6aa8
Subject: [LIBREPORT PATCH 88/93] bugzilla: add comment to closed bugs too
4b6aa8
4b6aa8
Resolves rhbz#1056101
4b6aa8
4b6aa8
Signed-off-by: Jakub Filak <jfilak@redhat.com>
4b6aa8
---
4b6aa8
 src/plugins/reporter-bugzilla.c | 103 ++++++++++++++++++++++++----------------
4b6aa8
 1 file changed, 62 insertions(+), 41 deletions(-)
4b6aa8
4b6aa8
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
4b6aa8
index 45aa2cc..097924e 100644
4b6aa8
--- a/src/plugins/reporter-bugzilla.c
4b6aa8
+++ b/src/plugins/reporter-bugzilla.c
4b6aa8
@@ -1266,54 +1266,75 @@ int main(int argc, char **argv)
4b6aa8
         }
4b6aa8
     }
4b6aa8
 
4b6aa8
-    if (strcmp(bz->bi_status, "CLOSED") != 0)
4b6aa8
+    /* We used to skip adding the comment to CLOSED bugs:
4b6aa8
+     *
4b6aa8
+     * if (strcmp(bz->bi_status, "CLOSED") != 0)
4b6aa8
+     * {
4b6aa8
+     *
4b6aa8
+     * But that condition has been added without a good explanation of the
4b6aa8
+     * reason for doing so:
4b6aa8
+     *
4b6aa8
+     * ABRT commit 1bf37ad93e87f065347fdb7224578d55cca8d384
4b6aa8
+     *
4b6aa8
+     * -    if (bug_id > 0)
4b6aa8
+     * +    if (strcmp(bz.bug_status, "CLOSED") != 0)
4b6aa8
+     *
4b6aa8
+     *
4b6aa8
+     * From my point of view, there is no good reason to not add the comment to
4b6aa8
+     * such a bug. The reporter spent several minutes waiting for the backtrace
4b6aa8
+     * and we don't want to make the reporters feel that they spent their time
4b6aa8
+     * in vain and I think that adding comments to already closed bugs doesn't
4b6aa8
+     * hurt the maintainers (at least not me).
4b6aa8
+     *
4b6aa8
+     * Plenty of new comments might convince the maintainer to reconsider the
4b6aa8
+     * bug's status.
4b6aa8
+     */
4b6aa8
+
4b6aa8
+    /* Add user's login to CC if not there already */
4b6aa8
+    if (strcmp(bz->bi_reporter, rhbz.b_login) != 0
4b6aa8
+     && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0)
4b6aa8
+    ) {
4b6aa8
+        log(_("Adding %s to CC list"), rhbz.b_login);
4b6aa8
+        rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY);
4b6aa8
+    }
4b6aa8
+
4b6aa8
+    /* Add comment and bt */
4b6aa8
+    const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
4b6aa8
+    if (comment && comment[0])
4b6aa8
     {
4b6aa8
-        /* Add user's login to CC if not there already */
4b6aa8
-        if (strcmp(bz->bi_reporter, rhbz.b_login) != 0
4b6aa8
-         && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0)
4b6aa8
-        ) {
4b6aa8
-            log(_("Adding %s to CC list"), rhbz.b_login);
4b6aa8
-            rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY);
4b6aa8
-        }
4b6aa8
+        GList *comment_fmt_spec = load_bzrep_conf_file(fmt_file2);
4b6aa8
+        struct strbuf *bzcomment_buf = strbuf_new();
4b6aa8
+        generate_bz_comment(bzcomment_buf, problem_data, comment_fmt_spec);
4b6aa8
+        char *bzcomment = strbuf_free_nobuf(bzcomment_buf);
4b6aa8
+//TODO: free_comment_fmt_spec(comment_fmt_spec);
4b6aa8
 
4b6aa8
-        /* Add comment and bt */
4b6aa8
-        const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
4b6aa8
-        if (comment && comment[0])
4b6aa8
+        int dup_comment = is_comment_dup(bz->bi_comments, bzcomment);
4b6aa8
+        if (!dup_comment)
4b6aa8
         {
4b6aa8
-            GList *comment_fmt_spec = load_bzrep_conf_file(fmt_file2);
4b6aa8
-            struct strbuf *bzcomment_buf = strbuf_new();
4b6aa8
-            generate_bz_comment(bzcomment_buf, problem_data, comment_fmt_spec);
4b6aa8
-            char *bzcomment = strbuf_free_nobuf(bzcomment_buf);
4b6aa8
-//TODO: free_comment_fmt_spec(comment_fmt_spec);
4b6aa8
+            log(_("Adding new comment to bug %d"), bz->bi_id);
4b6aa8
+            rhbz_add_comment(client, bz->bi_id, bzcomment, 0);
4b6aa8
+            free(bzcomment);
4b6aa8
 
4b6aa8
-            int dup_comment = is_comment_dup(bz->bi_comments, bzcomment);
4b6aa8
-            if (!dup_comment)
4b6aa8
-            {
4b6aa8
-                log(_("Adding new comment to bug %d"), bz->bi_id);
4b6aa8
-                rhbz_add_comment(client, bz->bi_id, bzcomment, 0);
4b6aa8
-                free(bzcomment);
4b6aa8
-
4b6aa8
-                const char *bt = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
4b6aa8
-                unsigned rating = 0;
4b6aa8
-                const char *rating_str = problem_data_get_content_or_NULL(problem_data, FILENAME_RATING);
4b6aa8
-                /* python doesn't have rating file */
4b6aa8
-                if (rating_str)
4b6aa8
-                    rating = xatou(rating_str);
4b6aa8
-                if (bt && rating > bz->bi_best_bt_rating)
4b6aa8
-                {
4b6aa8
-                    char bug_id_str[sizeof(int)*3 + 2];
4b6aa8
-                    sprintf(bug_id_str, "%i", bz->bi_id);
4b6aa8
-                    log(_("Attaching better backtrace"));
4b6aa8
-                    rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt),
4b6aa8
-                                     RHBZ_NOMAIL_NOTIFY);
4b6aa8
-                }
4b6aa8
-            }
4b6aa8
-            else
4b6aa8
+            const char *bt = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
4b6aa8
+            unsigned rating = 0;
4b6aa8
+            const char *rating_str = problem_data_get_content_or_NULL(problem_data, FILENAME_RATING);
4b6aa8
+            /* python doesn't have rating file */
4b6aa8
+            if (rating_str)
4b6aa8
+                rating = xatou(rating_str);
4b6aa8
+            if (bt && rating > bz->bi_best_bt_rating)
4b6aa8
             {
4b6aa8
-                free(bzcomment);
4b6aa8
-                log(_("Found the same comment in the bug history, not adding a new one"));
4b6aa8
+                char bug_id_str[sizeof(int)*3 + 2];
4b6aa8
+                sprintf(bug_id_str, "%i", bz->bi_id);
4b6aa8
+                log(_("Attaching better backtrace"));
4b6aa8
+                rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt),
4b6aa8
+                                 RHBZ_NOMAIL_NOTIFY);
4b6aa8
             }
4b6aa8
         }
4b6aa8
+        else
4b6aa8
+        {
4b6aa8
+            free(bzcomment);
4b6aa8
+            log(_("Found the same comment in the bug history, not adding a new one"));
4b6aa8
+        }
4b6aa8
     }
4b6aa8
 
4b6aa8
  log_out:
4b6aa8
-- 
4b6aa8
1.8.3.1
4b6aa8