← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~adeuring/launchpad/bug-596944-browser into lp:launchpad/db-devel

 

Abel Deuring has proposed merging lp:~adeuring/launchpad/bug-596944-browser into lp:launchpad/db-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


This branch adds a field to enable/disable duplicate searches to the bug tracker configuration forms for distribution source packages and for products.

The template for filing bugs now renders the "main bug report form" immediately if the duplicate search is disabled.

I talked with Deryck about writing unit tests for the changes, but we think it is better toland the branch before PQM closes tomorrow, so I simply extended an existing page test instead.

test: ./bin/test -vvt xx-product-guided-filebug.txt

no lint, excpet complaints about Moin headers in the page test

-- 
https://code.launchpad.net/~adeuring/launchpad/bug-596944-browser/+merge/42505
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~adeuring/launchpad/bug-596944-browser into lp:launchpad/db-devel.
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2010-11-25 10:18:51 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2010-12-02 16:31:56 +0000
@@ -163,6 +163,8 @@
         IBugTarget['bug_reporting_guidelines'])
     bug_reported_acknowledgement = copy_field(
         IBugTarget['bug_reported_acknowledgement'])
+    enable_bugfiling_duplicate_search = copy_field(
+        IBugTarget['enable_bugfiling_duplicate_search'])
 
 
 def product_to_productbugconfiguration(product):
@@ -187,12 +189,13 @@
     def field_names(self):
         """Return the list of field names to display."""
         field_names = [
-                "bugtracker",
-                "enable_bug_expiration",
-                "remote_product",
-                "bug_reporting_guidelines",
-                "bug_reported_acknowledgement",
-                ]
+            "bugtracker",
+            "enable_bug_expiration",
+            "remote_product",
+            "bug_reporting_guidelines",
+            "bug_reported_acknowledgement",
+            "enable_bugfiling_duplicate_search",
+            ]
         if check_permission("launchpad.Edit", self.context):
             field_names.extend(["bug_supervisor", "security_contact"])
 

=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
--- lib/lp/bugs/interfaces/bugtarget.py	2010-11-30 21:39:25 +0000
+++ lib/lp/bugs/interfaces/bugtarget.py	2010-12-02 16:31:56 +0000
@@ -299,6 +299,13 @@
 
     enable_bugfiling_duplicate_search = Bool(
         title=u"Search for possible duplicate bugs when a new bug is filed",
+        description=(
+            u"If enabled, Launchpad searches the project for bugs which "
+            u"could match the summary given by the bug reporter. However, "
+            u"this can lead users to mistake an existing bug as the one "
+            u"they want to report. This can happen for example for hardware "
+            u"related bugs where the one symptom can be caused by "
+            u"completely different hardware and drivers."),
         required=False)
 
     def createBug(bug_params):

=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-product-guided-filebug.txt'
--- lib/lp/bugs/stories/guided-filebug/xx-product-guided-filebug.txt	2010-08-02 02:33:53 +0000
+++ lib/lp/bugs/stories/guided-filebug/xx-product-guided-filebug.txt	2010-12-02 16:31:56 +0000
@@ -168,3 +168,26 @@
     'http://bugs.launchpad.dev/firefox/+bug/...'
     >>> user_browser.title
     "Bug #... in Mozilla Firefox: ...Frankenzombulon reanimated..."
+
+
+== Filing bugs without duplicate search ==
+
+Searching for duplicates can be switched off for a project.
+
+    >>> admin_browser.open(
+    ...     'https://bugs.launchpad.dev/firefox/+configure-bugtracker')
+    >>> duplicate_search = admin_browser.getControl(
+    ...     'Search for possible duplicate bugs when a new bug is filed')
+    >>> duplicate_search.selected = False
+    >>> admin_browser.getControl('Change').click()
+
+When a user now files a bug, he can immediately enter all bug details.
+
+    >>> user_browser.open('http://bugs.launchpad.dev/firefox/+filebug')
+    >>> user_browser.getControl('Summary').value = (
+    ...     'Frankenzombulon automatically answers all my mail.')
+    >>> user_browser.getControl('Further information').value = (
+    ...     'Frankenzombulon should ask me before doing that.')
+    >>> user_browser.getControl('Submit Bug Report').click()
+    >>> print user_browser.url
+    http://bugs.launchpad.dev/firefox/+bug/...

=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-search.pt	2010-06-15 12:59:53 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt	2010-12-02 16:31:56 +0000
@@ -14,7 +14,8 @@
             tal:define="lp_js string:${icingroot}/build"
             tal:attributes="src string:${lp_js}/bugs/filebug-dupefinder.js"></script>
 
-    <script type="text/javascript">
+    <script type="text/javascript"
+            tal:condition="context/enable_bugfiling_duplicate_search">
         LPS.use(
           'base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
           function(Y) {
@@ -51,88 +52,96 @@
         <div class="top-portlet"
             tal:define="launchpad_form_id string:filebug-search-form"
             tal:condition="not:view/extra_data_to_process">
-          <div metal:use-macro="context/@@launchpad_form/form">
-
-        <table metal:fill-slot="widgets">
-
-          <tal:product_widget
-              tal:define="widget nocall:view/widgets/product|nothing"
-              tal:condition="widget">
-            <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
-          </tal:product_widget>
-
-          <tal:bugtarget
-              tal:define="widget nocall:view/widgets/bugtarget|nothing"
-              tal:condition="widget">
-            <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
-          </tal:bugtarget>
-
-          <tal:hidden_tags tal:replace="structure view/widgets/tags/hidden" />
-
-          <tr>
-            <td colspan="2">
-              <p>
-                Please describe the bug in a few words, for example, "weather
-                applet crashes on logout":
-              </p>
-            </td>
-          </tr>
-          <tal:title_widget tal:define="widget nocall:view/widgets/title">
-            <tal:comment replace="nothing">
-              The desire to have more control over the styling of this widget
-              prevents us from using the widget_row macro here.
-            </tal:comment>
-            <tr>
-              <td tal:define="field_name widget/context/__name__;
-                              error python:view.getFieldError(field_name);
-                              error_class python:('error' if error else None);"
-                  tal:attributes="class error_class"
-                  style="text-align: left; padding-left: 5em;">
-                <div>
-                  <label tal:attributes="for widget/name"
-                         tal:content="string:${widget/label}:">Label</label>
-                  <input tal:replace="structure widget" />
-                </div>
-                <div class="message" tal:condition="error"
-                     tal:content="structure error">Error message</div>
-                <p class="formHelp"
-                   tal:condition="widget/hint"
-                   tal:content="widget/hint">Some Help Text
-                </p>
-              </td>
-              <td style="text-align: left;">
-                <input tal:replace="structure view/actions/field.actions.search/render" />
-                <span id="spinner" style="text-align: center" class="unseen">
-                  <img src="/@@/spinner" />
-                </span>
-              </td>
-            </tr>
-          </tal:title_widget>
-        </table>
-
-        <div metal:fill-slot="buttons">
-          <tal:comment replace="nothing">
-            We add this to hide the standard action buttons.
-          </tal:comment>
-        </div>
-      </div>
-    </div>
-
-    <div id="possible-duplicates" style="text-align: left;">
-    </div>
-    <div id="filebug-form-container" style="display: none;">
-    </div>
-
-    <p style="display: none">
-      <a id="filebug-base-url"
-          tal:attributes="href view/inline_filebug_base_url"></a>
-      <a id="filebug-form-url"
-          tal:attributes="href view/inline_filebug_form_url"></a>
-      <a id="duplicate-search-url"
-          tal:attributes="href view/duplicate_search_url"></a>
-    </p>
-    </tal:uses-malone>
-  </div>
+          <div tal:condition="not: context/enable_bugfiling_duplicate_search"
+               omit-tag="">
+            <metal:no-dupe-form
+                metal:use-macro="context/@@+filebug-macros/simple-filebug-form" />
+          </div>
+
+          <div tal:condition="context/enable_bugfiling_duplicate_search">
+            <div metal:use-macro="context/@@launchpad_form/form">
+
+              <table metal:fill-slot="widgets">
+
+                <tal:product_widget
+                    tal:define="widget nocall:view/widgets/product|nothing"
+                    tal:condition="widget">
+                  <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
+                </tal:product_widget>
+
+                <tal:bugtarget
+                    tal:define="widget nocall:view/widgets/bugtarget|nothing"
+                    tal:condition="widget">
+                  <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
+                </tal:bugtarget>
+
+                <tal:hidden_tags tal:replace="structure view/widgets/tags/hidden" />
+
+                <tr>
+                  <td colspan="2">
+                    <p>
+                      Please describe the bug in a few words, for example, "weather
+                      applet crashes on logout":
+                    </p>
+                  </td>
+                </tr>
+                <tal:title_widget tal:define="widget nocall:view/widgets/title">
+                  <tal:comment replace="nothing">
+                    The desire to have more control over the styling of this widget
+                    prevents us from using the widget_row macro here.
+                  </tal:comment>
+                  <tr>
+                    <td tal:define="field_name widget/context/__name__;
+                                    error python:view.getFieldError(field_name);
+                                    error_class python:('error' if error else None);"
+                        tal:attributes="class error_class"
+                        style="text-align: left; padding-left: 5em;">
+                      <div>
+                        <label tal:attributes="for widget/name"
+                               tal:content="string:${widget/label}:">Label</label>
+                        <input tal:replace="structure widget" />
+                      </div>
+                      <div class="message" tal:condition="error"
+                           tal:content="structure error">Error message</div>
+                      <p class="formHelp"
+                         tal:condition="widget/hint"
+                         tal:content="widget/hint">Some Help Text
+                      </p>
+                    </td>
+                    <td style="text-align: left;">
+                      <input tal:replace="structure view/actions/field.actions.search/render" />
+                      <span id="spinner" style="text-align: center" class="unseen">
+                        <img src="/@@/spinner" />
+                      </span>
+                    </td>
+                  </tr>
+                </tal:title_widget>
+              </table>
+
+              <div metal:fill-slot="buttons">
+                <tal:comment replace="nothing">
+                  We add this to hide the standard action buttons.
+                </tal:comment>
+              </div>
+            </div>
+          </div>
+        </div>
+
+        <div id="possible-duplicates" style="text-align: left;">
+        </div>
+        <div id="filebug-form-container" style="display: none;">
+        </div>
+
+        <p style="display: none">
+          <a id="filebug-base-url"
+              tal:attributes="href view/inline_filebug_base_url"></a>
+          <a id="filebug-form-url"
+              tal:attributes="href view/inline_filebug_form_url"></a>
+          <a id="duplicate-search-url"
+              tal:attributes="href view/duplicate_search_url"></a>
+        </p>
+      </tal:uses-malone>
+    </div>
 
   </div>
 

=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py	2010-11-19 03:11:05 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py	2010-12-02 16:31:56 +0000
@@ -133,7 +133,7 @@
         """Edit the details of this source package."""
         # This is titled "Edit bug reporting guidelines" because that
         # is the only editable property of a source package right now.
-        return Link('+edit', 'Edit bug reporting guidelines', icon='edit')
+        return Link('+edit', 'Configure bug tracker', icon='edit')
 
     def new_bugs(self):
         base_path = "+bugs"
@@ -544,6 +544,7 @@
     field_names = [
         'bug_reporting_guidelines',
         'bug_reported_acknowledgement',
+        'enable_bugfiling_duplicate_search',
         ]
 
     @property