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

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