launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08228
[Merge] lp:~wallyworld/launchpad/better-filebug-tal-javascript into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/better-filebug-tal-javascript into lp:launchpad with lp:~wallyworld/launchpad/die-FileBugInlineFormView-die as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/better-filebug-tal-javascript/+merge/107392
== Implementation ==
Rip filebug javascript out of the TAL. Repackage in a new filebug module. Kill an unneeded macro.
Now the functionality to enhance the file bug form can be added in the next branch.
== Demo and QA ==
Ensure filebug works as expected for products (with/without private by default bugs, with/without search for dupes), and project groups.
== Tests ==
New filebug yui tests.
Add tests for the filebug views to ensure the correct data is in the request cache.
Allow the banner to be initialised so that the animations are skipped for the tests.
== Lint ==
A fair few driveby fixes were done. Lint free now.
--
https://code.launchpad.net/~wallyworld/launchpad/better-filebug-tal-javascript/+merge/107392
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/better-filebug-tal-javascript into lp:launchpad.
=== modified file 'lib/lp/app/javascript/banners/banner.js'
--- lib/lp/app/javascript/banners/banner.js 2012-05-24 16:01:38 +0000
+++ lib/lp/app/javascript/banners/banner.js 2012-05-25 14:44:24 +0000
@@ -12,16 +12,17 @@
ns.Banner = Y.Base.create('banner', Y.Widget, [], {
_getAnimTimes: function() {
+ var anim_times;
if (this.get('skip_animation')) {
- var anim_times = {
+ anim_times = {
fade: 0.0,
- slide_out: 0.0,
- }
+ slide_out: 0.0
+ };
} else {
- var anim_times = {
+ anim_times = {
fade: 0.3,
- slide_out: 0.2,
- }
+ slide_out: 0.2
+ };
}
return anim_times;
},
@@ -31,13 +32,12 @@
body.addClass('global-notification-visible');
var global_notification = Y.one('.global-notification');
global_notification.removeClass('hidden');
-
var anim_times = this._getAnimTimes();
var fade_in = new Y.Anim({
node: global_notification,
to: {opacity: 1},
- duration: anim_times.fade
+ duration: anim_times.fade
});
var body_space = new Y.Anim({
node: body,
@@ -51,7 +51,6 @@
duration: anim_times.slide_out,
easing: Y.Easing.easeOut
});
-
fade_in.run();
body_space.run();
login_space.run();
@@ -67,7 +66,7 @@
var fade_out = new Y.Anim({
node: global_notification,
to: {opacity: 0},
- duration: anim_times.fade
+ duration: anim_times.fade
});
var body_space = new Y.Anim({
node: body,
@@ -96,7 +95,7 @@
renderUI: function () {
var banner_data = {
badge: this.get('banner_icon'),
- text: this.get('notification_text'),
+ text: this.get('notification_text')
};
var banner_html = Y.lp.mustache.to_html(
this.get('banner_template'),
@@ -107,20 +106,20 @@
bindUI: function() {
this.after('visibleChange', function() {
if (this.get('visible')) {
- this._showBanner();
+ this._showBanner();
} else {
- this._hideBanner();
+ this._hideBanner();
}
- });
+ });
},
updateText: function (new_text) {
if (!Y.Lang.isValue(new_text)) {
- new_text = this.get('notification_text');
+ new_text = this.get('notification_text');
}
- text_node = this.get('contentBox').one('.banner-text');
+ var text_node = this.get('contentBox').one('.banner-text');
text_node.set('text', new_text);
- },
+ }
}, {
ATTRS: {
@@ -129,14 +128,14 @@
banner_template: {
valueFn: function() {
return [
- '<div class="global-notification transparent hidden">',
+ '<div class="global-notification transparent hidden">',
'{{{ badge }}}',
'<span class="banner-text">{{ text }}</span>',
- "</div>"].join('')
- }
+ "</div>"].join('');
+ }
},
skip_animation: { value: false },
- visible: { value: false },
+ visible: { value: false }
}
});
=== modified file 'lib/lp/app/javascript/banners/privacy.js'
--- lib/lp/app/javascript/banners/privacy.js 2012-05-23 21:12:21 +0000
+++ lib/lp/app/javascript/banners/privacy.js 2012-05-25 14:44:24 +0000
@@ -10,24 +10,24 @@
},
banner_icon: {
value: '<span class="sprite notification-private"></span>'
- },
- }
+ }
+ }
});
// For the privacy banner to work, it needs to have one instance, and one
// instance only.
var _singleton_privacy_banner = null;
-ns.getPrivacyBanner = function (banner_text) {
-
+ns.getPrivacyBanner = function (banner_text, skip_animation) {
if (_singleton_privacy_banner === null) {
- var src = Y.one('.yui3-privacybanner')
- _singleton_privacy_banner = new ns.PrivacyBanner({ srcNode: src });
+ var src = Y.one('.yui3-privacybanner');
+ _singleton_privacy_banner = new ns.PrivacyBanner(
+ { srcNode: src, skip_animation: skip_animation });
_singleton_privacy_banner.render();
}
if (Y.Lang.isValue(banner_text)) {
- _singleton_privacy_banner.updateText(banner_text);
+ _singleton_privacy_banner.updateText(banner_text);
}
return _singleton_privacy_banner;
-}
+};
}, "0.1", {"requires": ["base", "node", "anim", "lp.app.banner"]});
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2012-05-25 14:44:24 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2012-05-25 14:44:24 +0000
@@ -275,6 +275,11 @@
type.name for type in PRIVATE_INFORMATION_TYPES]
cache.objects['show_information_type_in_ui'] = (
self.show_information_type_in_ui)
+ cache.objects['bug_private_by_default'] = (
+ IProduct.providedBy(self.context) and self.context.private_bugs)
+ cache.objects['enable_bugfiling_duplicate_search'] = (
+ IProjectGroup.providedBy(self.context)
+ or self.context.enable_bugfiling_duplicate_search)
def setUpFields(self):
"""Set up the form fields. See `LaunchpadFormView`."""
@@ -380,8 +385,11 @@
if self.redirect_ubuntu_filebug:
pass
LaunchpadFormView.initialize(self)
- if (not self.redirect_ubuntu_filebug and
- self.extra_data_token is not None and
+ cache = IJSONRequestCache(self.request)
+ cache.objects['enable_bugfiling_duplicate_search'] = (
+ IProjectGroup.providedBy(self.context)
+ or self.context.enable_bugfiling_duplicate_search)
+ if (self.extra_data_token is not None and
not self.extra_data_to_process):
# self.extra_data has been initialized in publishTraverse().
if self.extra_data.initial_summary:
@@ -466,10 +474,6 @@
return {'packagename': self.context.name}
- def isPrivate(self):
- """Whether bug reports on this target are private by default."""
- return IProduct.providedBy(self.context) and self.context.private_bugs
-
def contextIsProduct(self):
return IProduct.providedBy(self.context)
=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_filebug.py'
--- lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2012-05-25 14:44:24 +0000
+++ lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2012-05-25 14:44:24 +0000
@@ -1,5 +1,6 @@
# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from lazr.restful.interfaces._rest import IJSONRequestCache
__metaclass__ = type
@@ -20,7 +21,7 @@
IBugSet,
)
from lp.bugs.publisher import BugsLayer
-from lp.registry.enums import InformationType
+from lp.registry.enums import InformationType, PRIVATE_INFORMATION_TYPES
from lp.services.features.testing import FeatureFixture
from lp.services.webapp.servers import LaunchpadTestRequest
from lp.testing import (
@@ -433,3 +434,86 @@
notification.message
for notification in view.request.response.notifications])
self.assertIn("Thank you for your bug report.", msg)
+
+
+class TestFileBugGuidelinesRequestCache(TestCaseWithFactory):
+ # Tests to ensure the request cache contains the expected values for
+ # file bug guidelines views.
+
+ layer = DatabaseFunctionalLayer
+
+ def _assert_cache_values(self, view, private_bugs, duplicate_search):
+ cache = IJSONRequestCache(view.request).objects
+ self.assertContentEqual(cache['private_types'], [
+ type.name for type in PRIVATE_INFORMATION_TYPES])
+ self.assertEqual(cache['bug_private_by_default'], private_bugs)
+ self.assertEqual(
+ cache['enable_bugfiling_duplicate_search'], duplicate_search)
+
+ def test_product(self):
+ project = self.factory.makeProduct(official_malone=True)
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(project,
+ '+filebug-reporting-guidelines', principal=user)
+ self._assert_cache_values(view, False, True)
+
+ def test_product_default_private(self):
+ product = self.factory.makeProduct(official_malone=True)
+ removeSecurityProxy(product).private_bugs = True
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(product,
+ '+filebug-reporting-guidelines', principal=user)
+ self._assert_cache_values(view, True, True)
+
+ def test_product_no_duplicate_search(self):
+ product = self.factory.makeProduct(official_malone=True)
+ removeSecurityProxy(product).enable_bugfiling_duplicate_search = False
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(product,
+ '+filebug-reporting-guidelines', principal=user)
+ self._assert_cache_values(view, False, False)
+
+ def test_project_group(self):
+ project = self.factory.makeProject()
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(project,
+ '+filebug-reporting-guidelines', principal=user)
+ self._assert_cache_values(view, False, True)
+
+
+class TestFileBugRequestCache(TestCaseWithFactory):
+ # Tests to ensure the request cache contains the expected values for
+ # file bug views.
+
+ layer = DatabaseFunctionalLayer
+
+ def _assert_cache_values(self, view, duplicate_search):
+ cache = IJSONRequestCache(view.request).objects
+ self.assertEqual(
+ cache['enable_bugfiling_duplicate_search'], duplicate_search)
+
+ def test_product(self):
+ project = self.factory.makeProduct(official_malone=True)
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(project, '+filebug', principal=user)
+ self._assert_cache_values(view, True)
+
+ def test_product_no_duplicate_search(self):
+ product = self.factory.makeProduct(official_malone=True)
+ removeSecurityProxy(product).enable_bugfiling_duplicate_search = False
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(product, '+filebug', principal=user)
+ self._assert_cache_values(view, False)
+
+ def test_project_group(self):
+ project = self.factory.makeProject()
+ user = self.factory.makePerson()
+ login_person(user)
+ view = create_initialized_view(project, '+filebug', principal=user)
+ self._assert_cache_values(view, True)
=== added file 'lib/lp/bugs/javascript/filebug.js'
--- lib/lp/bugs/javascript/filebug.js 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/javascript/filebug.js 2012-05-25 14:44:24 +0000
@@ -0,0 +1,75 @@
+/* Copyright 2012 Canonical Ltd. This software is licensed under the
+ * GNU Affero General Public License version 3 (see the file LICENSE).
+ *
+ * Provide functionality for the file bug pages.
+ *
+ * @module bugs
+ * @submodule filebug
+ */
+YUI.add('lp.bugs.filebug', function(Y) {
+
+var namespace = Y.namespace('lp.bugs.filebug');
+
+// For tests.
+var skip_animation;
+
+var setup_filebug = function(skip_anim) {
+ skip_animation = skip_anim;
+ if (LP.cache.enable_bugfiling_duplicate_search) {
+ Y.lp.bugs.filebug_dupefinder.setup_dupe_finder();
+ Y.lp.bugs.filebug_dupefinder.setup_dupes();
+ }
+ var search_button = Y.one(Y.DOM.byId('field.actions.projectgroupsearch'));
+ if (Y.Lang.isValue(search_button )) {
+ search_button.set('value', 'Check again');
+ }
+ if (LP.cache.show_information_type_in_ui) {
+ setup_information_type();
+ } else {
+ setup_security_related();
+ }
+ var filebug_privacy_text = "This report will be private. " +
+ "You can disclose it later.";
+ update_privacy_banner(
+ LP.cache.bug_private_by_default, filebug_privacy_text);
+};
+
+var update_privacy_banner = function(show, banner_text) {
+ var banner = Y.lp.app.banner.privacy.getPrivacyBanner(
+ banner_text, skip_animation);
+ if (show) {
+ banner.show();
+ } else {
+ banner.hide();
+ }
+};
+
+var setup_information_type = function() {
+ var itypes_table = Y.one('.radio-button-widget');
+ itypes_table.delegate('click', function() {
+ var private_type = (Y.Array.indexOf(
+ LP.cache.private_types, this.get('value')) >= 0);
+ update_privacy_banner(private_type);
+ }, "input[name='field.information_type']");
+};
+
+var setup_security_related = function() {
+ var sec = Y.one('[id="field.security_related"]');
+ if (!Y.Lang.isValue(sec)) {
+ return;
+ }
+ var notification_text = "This report will be private " +
+ "because it is a security " +
+ "vulnerability. You can " +
+ "disclose it later.";
+ sec.on('change', function() {
+ var checked = sec.get('checked');
+ update_privacy_banner(checked, notification_text);
+ });
+};
+
+namespace.setup_filebug = setup_filebug;
+
+}, "0.1", {"requires": [
+ "base", "node", "event", "node-event-delegate",
+ "lp.app.banner.privacy", "lp.bugs.filebug_dupefinder"]});
=== modified file 'lib/lp/bugs/javascript/filebug_dupefinder.js'
--- lib/lp/bugs/javascript/filebug_dupefinder.js 2012-01-18 13:54:33 +0000
+++ lib/lp/bugs/javascript/filebug_dupefinder.js 2012-05-25 14:44:24 +0000
@@ -470,21 +470,16 @@
};
namespace.setup_dupe_finder = function() {
- Y.on('domready', function() {
- config = {on: {success: set_up_dupe_finder,
- failure: function() {}}};
-
- // Load the filebug form asynchronously. If this fails we
- // degrade to the standard mode for bug filing, clicking through
- // to the second part of the bug filing form.
- var filebug_form_url_element = Y.one(
- '#filebug-form-url');
- if (Y.Lang.isValue(filebug_form_url_element)) {
- var filebug_form_url = filebug_form_url_element.getAttribute(
- 'href');
- YIO.io(filebug_form_url, config);
- }
- });
+ var config = {on: {success: set_up_dupe_finder,
+ failure: function() {}}};
+ // Load the filebug form asynchronously. If this fails we
+ // degrade to the standard mode for bug filing, clicking through
+ // to the second part of the bug filing form.
+ var filebug_form_url_element = Y.one('#filebug-form-url');
+ if (Y.Lang.isValue(filebug_form_url_element)) {
+ var filebug_form_url = filebug_form_url_element.getAttribute('href');
+ YIO.io(filebug_form_url, config);
+ }
};
/**
=== added file 'lib/lp/bugs/javascript/tests/test_filebug.html'
--- lib/lp/bugs/javascript/tests/test_filebug.html 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/javascript/tests/test_filebug.html 2012-05-25 14:44:24 +0000
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<!--
+Copyright 2012 Canonical Ltd. This software is licensed under the
+GNU Affero General Public License version 3 (see the file LICENSE).
+-->
+
+<html>
+ <head>
+ <title>File Bug View Tests</title>
+
+ <!-- YUI and test setup -->
+ <script type="text/javascript"
+ src="../../../../../build/js/yui/yui/yui.js">
+ </script>
+ <link rel="stylesheet"
+ href="../../../../../build/js/yui/console/assets/console-core.css" />
+ <link rel="stylesheet"
+ href="../../../../../build/js/yui/console/assets/skins/sam/console.css" />
+ <link rel="stylesheet"
+ href="../../../../../build/js/yui/test/assets/skins/sam/test.css" />
+
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/testing/testrunner.js"></script>
+
+ <link rel="stylesheet" href="../../../app/javascript/testing/test.css" />
+
+ <!-- Dependencies -->
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/mustache.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/expander.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/formoverlay/formoverlay.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/formwidgets/formwidgets.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/formwidgets/resizing_textarea.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/overlay/overlay.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/anim/anim.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/bugs/filebug_dupefinder.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/effects/effects.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/extras/extras.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/banners/banner.js"></script>
+ <script type="text/javascript"
+ src="../../../../../build/js/lp/app/banners/privacy.js"></script>
+
+ <!-- The module under test. -->
+ <script type="text/javascript" src="../filebug.js"></script>
+
+ <!-- The test suite -->
+ <script type="text/javascript" src="test_filebug.js"></script>
+
+ </head>
+ <body class="yui3-skin-sam">
+ <ul id="suites">
+ <li>lp.bugs.filebug.test</li>
+ </ul>
+ <div class='login-logout'></div>
+ <div id="fixture"></div>
+ <script type="text/x-template" id="privacy-banner-template">
+ <table class="radio-button-widget">
+ <tbody>
+ <tr>
+ <td><input type="radio" value="PUBLIC" name="field.information_type"
+ id="field.information_type.0" checked="checked" class="radioType">
+ </td>
+ <td><label for="field.information_type.0">Public</label></td>
+ </tr>
+ <tr>
+ <td><input type="radio" value="UNEMBARGOEDSECURITY" name="field.information_type"
+ id="field.information_type.1"class="radioType">
+ </td>
+ <td><label for="field.information_type.1">Unembargoed Security</label></td>
+ </tr>
+ <tr>
+ <td><input type="radio" value="EMBARGOEDSECURITY" name="field.information_type"
+ id="field.information_type.2"class="radioType">
+ </td>
+ <td><label for="field.information_type.2">Embargoed Security</label></td>
+ </tr>
+ <tr>
+ <td><input type="radio" value="USERDATA" name="field.information_type"
+ id="field.information_type.3"class="radioType">
+ </td>
+ <td><label for="field.information_type.3">User Data</label></td>
+ </tr>
+ <tr>
+ <td><input type="radio" value="PROPRIETARY" name="field.information_type"
+ id="field.information_type.4"class="radioType">
+ </td>
+ <td><label for="field.information_type.4">Proprietary</label></td>
+ </tr>
+ </tbody>
+ </table>
+ </script>
+ </body>
+</html>
=== added file 'lib/lp/bugs/javascript/tests/test_filebug.js'
--- lib/lp/bugs/javascript/tests/test_filebug.js 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/javascript/tests/test_filebug.js 2012-05-25 14:44:24 +0000
@@ -0,0 +1,113 @@
+/* Copyright (c) 2012, Canonical Ltd. All rights reserved. */
+
+YUI.add('lp.bugs.filebug.test', function (Y) {
+
+ var tests = Y.namespace('lp.bugs.filebug.test');
+ tests.suite = new Y.Test.Suite(
+ 'lp.bugs.filebug Tests');
+
+ tests.suite.add(new Y.Test.Case({
+ name: 'lp.bugs.filebug_tests',
+
+ setUp: function () {
+ window.LP = {
+ links: {},
+ cache: {
+ private_types: ['EMBARGOEDSECURITY', 'USERDATA']
+ }
+ };
+ this.fixture = Y.one('#fixture');
+ var banner = Y.Node.create(
+ Y.one('#privacy-banner-template').getContent());
+ this.fixture.appendChild(banner);
+ },
+
+ tearDown: function () {
+ if (this.fixture !== null) {
+ this.fixture.empty(true);
+ }
+ delete this.fixture;
+ delete window.LP;
+ },
+
+ test_library_exists: function () {
+ Y.Assert.isObject(Y.lp.bugs.filebug,
+ "Could not locate the " +
+ "lp.bugs.filebug module");
+ },
+
+ // Filing a public bug does not show the privacy banner.
+ test_setup_filebug_public: function () {
+ Y.lp.bugs.filebug.setup_filebug(true);
+ var banner_hidden = Y.one('.yui3-privacybanner-hidden');
+ Y.Assert.isNotNull(banner_hidden);
+ },
+
+ // Filing a bug for a project with private bugs shows the privacy
+ // banner.
+ test_setup_filebug_private: function () {
+ window.LP.cache.bug_private_by_default = true;
+ Y.lp.bugs.filebug.setup_filebug(true);
+ var banner_hidden = Y.one('.yui3-privacybanner-hidden');
+ Y.Assert.isNull(banner_hidden);
+ var banner_text = Y.one('.banner-text').get('text');
+ Y.Assert.areEqual(
+ 'This report will be private. ' +
+ 'You can disclose it later.', banner_text);
+ },
+
+ // Selecting a private info type turns on the privacy banner.
+ test_select_private_info_type: function () {
+ window.LP.cache.show_information_type_in_ui = true;
+ Y.lp.bugs.filebug.setup_filebug(true);
+ var banner_hidden = Y.one('.yui3-privacybanner-hidden');
+ Y.Assert.isNotNull(banner_hidden);
+ Y.one('[id=field.information_type.2]').simulate('click');
+ banner_hidden = Y.one('.yui3-privacybanner-hidden');
+ Y.Assert.isNull(banner_hidden);
+ var banner_text = Y.one('.banner-text').get('text');
+ Y.Assert.areEqual(
+ 'This report will be private. ' +
+ 'You can disclose it later.', banner_text);
+ },
+
+ // Selecting a public info type turns off the privacy banner.
+ test_select_public_info_type: function () {
+ window.LP.cache.show_information_type_in_ui = true;
+ window.LP.cache.bug_private_by_default = true;
+ Y.lp.bugs.filebug.setup_filebug(true);
+ var banner_hidden = Y.one('.yui3-privacybanner-hidden');
+ Y.Assert.isNull(banner_hidden);
+ Y.one('[id=field.information_type.0]').simulate('click');
+ banner_hidden = Y.one('.yui3-privacybanner-hidden');
+ Y.Assert.isNotNull(banner_hidden);
+ },
+
+ // The dupe finder functionality is setup.
+ test_dupe_finder_setup: function () {
+ window.LP.cache.enable_bugfiling_duplicate_search = true;
+ var orig_setup_dupe_finder =
+ Y.lp.bugs.filebug_dupefinder.setup_dupe_finder;
+ var orig_setup_dupes =
+ Y.lp.bugs.filebug_dupefinder.setup_dupes;
+ var setup_dupe_finder_called = false;
+ var setup_dupes_called = false;
+ Y.lp.bugs.filebug_dupefinder.setup_dupe_finder = function() {
+ setup_dupe_finder_called = true;
+ };
+ Y.lp.bugs.filebug_dupefinder.setup_dupes = function() {
+ setup_dupes_called = true;
+ };
+ Y.lp.bugs.filebug.setup_filebug(true);
+ Y.Assert.isTrue(setup_dupe_finder_called);
+ Y.Assert.isTrue(setup_dupes_called);
+ Y.lp.bugs.filebug_dupefinder.setup_dupes = orig_setup_dupes;
+ Y.lp.bugs.filebug_dupefinder.setup_dupe_finder
+ = orig_setup_dupe_finder;
+ }
+ }));
+
+}, '0.1', {'requires': ['test', 'console', 'event', 'node-event-simulate',
+ 'lp.app.banner.privacy', 'lp.bugs.filebug_dupefinder',
+ 'lp.bugs.filebug'
+ ]});
=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-search.pt 2012-02-01 15:31:32 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt 2012-05-25 14:44:24 +0000
@@ -6,15 +6,13 @@
metal:use-macro="view/macro:page/main_only">
<metal:block fill-slot="head_epilogue">
- <script type="text/javascript"
- tal:condition="context/enable_bugfiling_duplicate_search">
- LPJS.use(
- 'base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
- function(Y) {
- Y.lp.bugs.filebug_dupefinder.setup_dupe_finder();
+ <script type="text/javascript">
+ LPJS.use('lp.bugs.filebug', function(Y) {
+ Y.on('domready', function() {
+ Y.lp.bugs.filebug.setup_filebug();
+ });
});
</script>
- <metal:privacy use-macro="view/@@+filebug-macros/bug-reporting-privacy" />
<meta http-equiv="refresh" content="10"
tal:condition="view/extra_data_to_process"/>
</metal:block>
=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt'
--- lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt 2012-02-01 15:31:32 +0000
+++ lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt 2012-05-25 14:44:24 +0000
@@ -7,14 +7,13 @@
<metal:block fill-slot="head_epilogue">
<script type="text/javascript">
- LPJS.use('base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
+ LPJS.use('lp.bugs.filebug',
function(Y) {
Y.on('domready', function() {
- Y.lp.bugs.filebug_dupefinder.setup_dupes();
+ Y.lp.bugs.filebug.setup_filebug();
});
});
</script>
- <metal:privacy use-macro="view/@@+filebug-macros/bug-reporting-privacy"/>
</metal:block>
<div metal:fill-slot="heading">
=== modified file 'lib/lp/bugs/templates/bugtarget-macros-filebug.pt'
--- lib/lp/bugs/templates/bugtarget-macros-filebug.pt 2012-05-22 22:25:33 +0000
+++ lib/lp/bugs/templates/bugtarget-macros-filebug.pt 2012-05-25 14:44:24 +0000
@@ -325,69 +325,6 @@
</tr>
</metal:bug_reporting_guidelines>
-<metal:privacy define-macro="bug-reporting-privacy">
- <tal:private condition="view/isPrivate">
- <script type="text/javascript">
- LPJS.use('lp.app.banner.privacy', function(Y) {
- Y.on('domready', function() {
- var notification_text = "This report will be private. " +
- "You can disclose it later.";
- var banner = Y.lp.app.banner.privacy.getPrivacyBanner(
- notification_text);
- banner.show();
- });
- });
- </script>
- </tal:private>
- <tal:flip-privacy>
- <script type="text/javascript">
- LPJS.use('node-event-delegate', 'lp.app.banner.privacy', function(Y) {
- var setup_information_type = function() {
- var itypes_table = Y.one('.radio-button-widget');
- itypes_table.delegate('click', function() {
- var private_type = (Y.Array.indexOf(
- LP.cache.private_types, this.get('value')) >= 0);
- privacy_ns = Y.lp.app.banner.privacy;
- var banner = privacy_ns.getPrivacyBanner();
- if (private_type) {
- banner.show();
- } else {
- banner.hide();
- }
- }, "input[name='field.information_type']");
- };
- var setup_security_related = function() {
- var notification_text: "This report will be private " +
- "because it is a security " +
- "vulnerability. You can " +
- "disclose it later.";
- };
- var privacy_ns = Y.lp.app.banner.privacy;
- var banner = privacy_ns.getPrivacyBanner(
- notification_text);
- banner.render();
- var sec = Y.one('[id="field.security_related"]');
- sec.on('change', function() {
- var checked = sec.get('checked');
- if (checked) {
- banner.show();
- } else {
- banner.hide();
- }
- });
- };
- Y.on('domready', function() {
- if (LP.cache.show_information_type_in_ui) {
- setup_information_type();
- } else {
- setup_security_related();
- }
- });
- });
- </script>
- </tal:flip-privacy>
-</metal:privacy>
-
<metal:similar-bugs define-macro="display-similar-bugs">
<tal:results-intro-with-summary condition="view/show_summary_in_results">
<p id="filebug-query-heading">
=== modified file 'lib/lp/bugs/templates/projectgroup-filebug-search.pt'
--- lib/lp/bugs/templates/projectgroup-filebug-search.pt 2012-02-01 15:31:32 +0000
+++ lib/lp/bugs/templates/projectgroup-filebug-search.pt 2012-05-25 14:44:24 +0000
@@ -7,18 +7,14 @@
<metal:block fill-slot="head_epilogue">
<script type="text/javascript">
- LPJS.use('base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
- function(Y) {
- Y.on('domready', function() {
- Y.lp.bugs.filebug_dupefinder.setup_dupes();
- Y.lp.bugs.filebug_dupefinder.setup_dupe_finder();
- var search_button = Y.one(Y.DOM.byId('field.actions.projectgroupsearch'));
- if (search_button != null)
- search_button.set('value', 'Check again');
- });
- });
+ LPJS.use(
+ 'lp.bugs.filebug',
+ function(Y) {
+ Y.on('domready', function() {
+ Y.lp.bugs.filebug.setup_filebug();
+ });
+ });
</script>
- <metal:privacy use-macro="view/@@+filebug-macros/bug-reporting-privacy"/>
</metal:block>
<div metal:fill-slot="heading">
Follow ups