summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/BMO')
-rw-r--r--extensions/BMO/Extension.pm138
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-shield-studies-data-review.txt.tmpl28
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-shield-studies-legal.txt.tmpl16
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-shield-studies-shipping-status.txt.tmpl25
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-shield-studies-validation-review.txt.tmpl34
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-shield-studies.txt.tmpl64
-rw-r--r--extensions/BMO/template/en/default/bug/create/create-shield-studies.html.tmpl217
-rw-r--r--extensions/BMO/web/js/shield_studies.js15
8 files changed, 537 insertions, 0 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 34af43892..da62861ca 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -29,6 +29,7 @@ use warnings;
use base qw(Bugzilla::Extension);
+use Bugzilla::Bug;
use Bugzilla::BugMail;
use Bugzilla::Constants;
use Bugzilla::Error;
@@ -1852,6 +1853,9 @@ sub post_bug_after_creation {
elsif ($format eq 'dev-engagement-event') {
$self->_post_dev_engagement($args);
}
+ elsif ($format eq 'shield-studies') {
+ $self->_post_shield_studies($args);
+ }
}
sub _post_employee_incident_bug {
@@ -2101,6 +2105,140 @@ EOF
$parent_bug->update($parent_bug->creation_ts);
}
+sub _post_shield_studies {
+ my ($self, $args) = @_;
+ my $vars = $args->{vars};
+ my $parent_bug = $vars->{bug};
+ my $params = Bugzilla->input_params;
+ my (@dep_comment, @dep_errors, @send_mail);
+
+ # Common parameters always passed to _file_child_bug
+ # bug_data and template_suffix will be different for each bug
+ my $child_params = {
+ parent_bug => $parent_bug,
+ template_vars => $vars,
+ dep_comment => \@dep_comment,
+ dep_errors => \@dep_errors,
+ send_mail => \@send_mail,
+ };
+
+ # Study Validation Review
+ $child_params->{'bug_data'} = {
+ short_desc => '[SHIELD] Study Validation Review for ' . $params->{hypothesis},
+ product => 'Shield',
+ component => 'Shield Study',
+ bug_severity => 'normal',
+ op_sys => 'All',
+ rep_platform => 'All',
+ version => 'unspecified',
+ blocked => $parent_bug->bug_id,
+ };
+ $child_params->{'template_suffix'} = 'validation-review';
+ _file_child_bug($child_params);
+
+ # Shipping Status
+ $child_params->{'bug_data'} = {
+ short_desc => '[SHIELD] Shipping Status for ' . $params->{hypothesis},
+ product => 'Shield',
+ component => 'Shield Study',
+ bug_severity => 'normal',
+ op_sys => 'All',
+ rep_platform => 'All',
+ version => 'unspecified',
+ blocked => $parent_bug->bug_id,
+ };
+ $child_params->{'template_suffix'} = 'shipping-status';
+
+ # Data Review
+ _file_child_bug($child_params);
+ $child_params->{'bug_data'} = {
+ short_desc => '[SHIELD] Data Review for ' . $params->{hypothesis},
+ product => 'Shield',
+ component => 'Shield Study',
+ bug_severity => 'normal',
+ op_sys => 'All',
+ rep_platform => 'All',
+ version => 'unspecified',
+ blocked => $parent_bug->bug_id,
+ };
+ $child_params->{'template_suffix'} = 'data-review';
+ _file_child_bug($child_params);
+
+ # Legal Review
+ $child_params->{'bug_data'} = {
+ short_desc => '[SHIELD] Legal Review for ' . $params->{hypothesis},
+ product => 'Legal',
+ component => 'Firefox',
+ bug_severity => 'normal',
+ op_sys => 'All',
+ rep_platform => 'All',
+ groups => [ 'mozilla-employee-confidential' ],
+ version => 'unspecified',
+ blocked => $parent_bug->bug_id,
+ };
+ $child_params->{'template_suffix'} = 'legal';
+ _file_child_bug($child_params);
+
+ if (scalar @dep_errors) {
+ warn "[Bug " . $parent_bug->id . "] Failed to create additional moz-project-review bugs:\n" .
+ join("\n", @dep_errors);
+ $vars->{'message'} = 'moz_project_review_creation_failed';
+ }
+
+ if (scalar @dep_comment) {
+ my $comment = join("\n", @dep_comment);
+ if (scalar @dep_errors) {
+ $comment .= "\n\nSome errors occurred creating dependent bugs and have been recorded";
+ }
+ $parent_bug->add_comment($comment);
+ $parent_bug->update($parent_bug->creation_ts);
+ }
+
+ foreach my $bug_id (@send_mail) {
+ Bugzilla::BugMail::Send($bug_id, { changer => Bugzilla->user });
+ }
+}
+
+sub _file_child_bug {
+ my ($params) = @_;
+ my ($parent_bug, $template_vars, $template_suffix, $bug_data, $dep_comment, $dep_errors, $send_mail)
+ = @$params{qw(parent_bug template_vars template_suffix bug_data dep_comment dep_errors send_mail)};
+ my $old_error_mode = Bugzilla->error_mode;
+ Bugzilla->error_mode(ERROR_MODE_DIE);
+
+ my $new_bug;
+ eval {
+ my $comment;
+ my $full_template = "bug/create/comment-shield-studies-$template_suffix.txt.tmpl";
+ Bugzilla->template->process($full_template, $template_vars, \$comment)
+ || ThrowTemplateError(Bugzilla->template->error());
+ $bug_data->{'comment'} = $comment;
+ if ($new_bug = Bugzilla::Bug->create($bug_data)) {
+ my $set_all = {
+ dependson => { add => [ $new_bug->bug_id ] }
+ };
+ $parent_bug->set_all($set_all);
+ $parent_bug->update($parent_bug->creation_ts);
+ }
+ };
+
+ if ($@ || !($new_bug && $new_bug->{'bug_id'})) {
+ push(@$dep_comment, "Error creating $template_suffix review bug");
+ push(@$dep_errors, "$template_suffix : $@") if $@;
+ # Since we performed Bugzilla::Bug::create in an eval block, we
+ # need to manually rollback the commit as this is not done
+ # in Bugzilla::Error automatically for eval'ed code.
+ Bugzilla->dbh->bz_rollback_transaction();
+ }
+ else {
+ push(@$send_mail, $new_bug->id);
+ push(@$dep_comment, "Bug " . $new_bug->id . " - " . $new_bug->short_desc);
+ }
+
+ undef $@;
+ Bugzilla->error_mode($old_error_mode);
+}
+
sub _pre_fxos_feature {
my ($self, $args) = @_;
my $cgi = Bugzilla->cgi;
diff --git a/extensions/BMO/template/en/default/bug/create/comment-shield-studies-data-review.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-data-review.txt.tmpl
new file mode 100644
index 000000000..358ebd398
--- /dev/null
+++ b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-data-review.txt.tmpl
@@ -0,0 +1,28 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% USE Bugzilla %]
+[% cgi = Bugzilla.cgi %]
+
+> If you have extended Telemetry or custom instrumentation, why are you taking these additional measurements?
+[%+ cgi.param('additional_measurements') %]
+
+> Will your study require third-party data collection?
+[%+ cgi.param('third_party_data') %]
+
+> Please include a sample payload that your study will submit via Unified Telemetry.
+[%+ cgi.param('sample_payload') %]
+
+> Who is the owner of the data analysis for this study?
+[%+ cgi.param('data_owner') %]
+
+> Does your data analyst have an analysis plan?
+[%+ cgi.param('analysis_plan') %]
+
+> How long will your study run?
+[%+ cgi.param('study_length') %]
diff --git a/extensions/BMO/template/en/default/bug/create/comment-shield-studies-legal.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-legal.txt.tmpl
new file mode 100644
index 000000000..17f38993c
--- /dev/null
+++ b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-legal.txt.tmpl
@@ -0,0 +1,16 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% USE Bugzilla %]
+[% cgi = Bugzilla.cgi %]a
+
+> Pleasese include a link to the consent form.
+[%+ cgi.param('consent_form') %]
+
+> Please include a link to debrief survey.
+[%+ cgi.param('debrief_survey') %]
diff --git a/extensions/BMO/template/en/default/bug/create/comment-shield-studies-shipping-status.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-shipping-status.txt.tmpl
new file mode 100644
index 000000000..190fa0631
--- /dev/null
+++ b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-shipping-status.txt.tmpl
@@ -0,0 +1,25 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% USE Bugzilla %]
+[% cgi = Bugzilla.cgi %]
+
+> Targeted locales
+[%+ cgi.param('targetted_locales') %]
+
+> Sampling rates
+[%+ cgi.param('sampling_rates') %]
+
+> Channel(s)
+[%+ cgi.param('channels') %]
+
+> What is the sample size needed?
+[%+ cgi.param('sample_size') %]
+
+> How long will your study run?
+[%+ cgi.param('study_length') %]
diff --git a/extensions/BMO/template/en/default/bug/create/comment-shield-studies-validation-review.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-validation-review.txt.tmpl
new file mode 100644
index 000000000..b3963d633
--- /dev/null
+++ b/extensions/BMO/template/en/default/bug/create/comment-shield-studies-validation-review.txt.tmpl
@@ -0,0 +1,34 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% USE Bugzilla %]
+[% cgi = Bugzilla.cgi %]
+
+> What is your hypothesis?
+[%+ cgi.param('hypothesis') %]
+
+> Define the branches of your proposed study
+[%+ cgi.param('branches') %]
+
+> What is the main effect you are looking for?
+[%+ cgi.param('main_effect') %]
+
+> How will this effect be measured?
+[%+ cgi.param('effect_measured') %]
+
+> What is the sample size needed?
+[%+ cgi.param('sample_size') %]
+
+> If there is prior art or previous results?
+[%+ cgi.param('prior_art') %]
+
+> How do you intend to test your study prior to launch?
+[%+ cgi.param('test_method') %]
+
+> How long will your study run?
+[%+ cgi.param('study_length') %]
diff --git a/extensions/BMO/template/en/default/bug/create/comment-shield-studies.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-shield-studies.txt.tmpl
new file mode 100644
index 000000000..c9217d002
--- /dev/null
+++ b/extensions/BMO/template/en/default/bug/create/comment-shield-studies.txt.tmpl
@@ -0,0 +1,64 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% USE Bugzilla %]
+[% cgi = Bugzilla.cgi %]
+
+> What is your hypothesis?
+[%+ cgi.param('hypothesis') %]
+
+> Define the branches of your proposed study
+[%+ cgi.param('branches') %]
+
+> What is the main effect you are looking for?
+[%+ cgi.param('main_effect') %]
+
+> How will this effect be measured?
+[%+ cgi.param('effect_measured') %]
+
+> What is the sample size needed?
+[%+ cgi.param('sample_size') %]
+
+> If there is prior art or previous results?
+[%+ cgi.param('prior_art') %]
+
+> How do you intend to test your study prior to launch?
+[%+ cgi.param('test_method') %]
+
+> How long will your study run?
+[%+ cgi.param('study_length') %]
+
+> Targeted locales
+[%+ cgi.param('targetted_locales') %]
+
+> Sampling rates
+[%+ cgi.param('sampling_rates') %]
+
+> Channel(s)
+[%+ cgi.param('channels') %]
+
+> If you have extended Telemetry or custom instrumentation, why are you taking these additional measurements?
+[%+ cgi.param('additional_measurements') %]
+
+> Will your study require third-party data collection?
+[%+ cgi.param('third_party_data') %]
+
+> Please include a sample payload that your study will submit via Unified Telemetry.
+[%+ cgi.param('sample_payload') %]
+
+> Who is the owner of the data analysis for this study?
+[%+ cgi.param('data_owner') %]
+
+> Does your data analyst have an analysis plan?
+[%+ cgi.param('analysis_plan') %]
+
+> Pleasese include a link to the consent form.
+[%+ cgi.param('consent_form') %]
+
+> Please include a link to debrief survey.
+[%+ cgi.param('debrief_survey') %]
diff --git a/extensions/BMO/template/en/default/bug/create/create-shield-studies.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-shield-studies.html.tmpl
new file mode 100644
index 000000000..9bc6c0de0
--- /dev/null
+++ b/extensions/BMO/template/en/default/bug/create/create-shield-studies.html.tmpl
@@ -0,0 +1,217 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% PROCESS global/variables.none.tmpl %]
+
+[% inline_css = BLOCK %]
+#shieldStudies .required:after {
+ content: " *";
+ color: red;
+}
+#shieldStudies h3 {
+ color: rgb(109, 117, 129);
+}
+#shieldStudies .field_label {
+ text-align: left;
+ font-weight: bold;
+ display: block;
+}
+#shieldStudies .field_desc {
+ word-wrap: normal;
+}
+#shieldStudies .form_section {
+ margin-bottom: 1em;
+ padding-left: 1em;
+}
+[% END %]
+
+[% PROCESS global/header.html.tmpl
+ title = "Shield Studies Form"
+ style = inline_css
+ javascript_urls = [ 'extensions/BMO/web/js/shield_studies.js' ]
+%]
+
+<h2>Shield Studies Form</h2>
+
+<p>
+ [ <span class="required_star">*</span> <span class="required_explanation">Required Field</span> ]
+</p>
+
+<form method="post" action="post_bug.cgi" id="shieldStudies" class="enter_bug_form" enctype="multipart/form-data">
+<input type="hidden" name="format" id="format" value="shield-studies">
+<input type="hidden" name="product" id="product" value="Shield">
+<input type="hidden" name="component" id="component" value="Shield Study">
+<input type="hidden" name="rep_platform" id="rep_platform" value="All">
+<input type="hidden" name="op_sys" id="op_sys" value="All">
+<input type="hidden" name="priority" id="priority" value="--">
+<input type="hidden" name="version" id="version" value="unspecified">
+<input type="hidden" name="comment" id="comment" value="">
+<input type="hidden" name="status_whiteboard" id="status_whiteboard" value="">
+<input type="hidden" name="short_desc" id="short_desc" value="">
+<input type="hidden" name="token" id="token" value="[% token FILTER html %]">
+
+<h3>Study Validation Review</h3>
+
+<div class="form_section">
+ <label for="hypothesis" class="field_label required">
+ What is your hypothesis?
+ </label>
+ <div class="field_desc">
+ What are you testing?
+ </div>
+ <input type="text" name="hypothesis" id="hypothesis" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="branches" class="field_label required">
+ Define the branches of your proposed study
+ </label>
+ <textarea name="branches" id="branches" rows="10" cols="60" required="true"></textarea>
+</div>
+
+<div class="form_section">
+ <label for="main_effect" class="field_label required">
+ What is the main effect you are looking for?
+ </label>
+ <input type="text" name="main_effect" id="main_effect" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="effect_measured" class="field_label required">
+ How will this effect be measured?
+ </label>
+ <div class="field_desc">
+ I.e., what is your instrumentation?
+ </div>
+ <input type="text" name="effect_measured" id="effect_measured" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="sample_size" class="field_label required">
+ What is the sample size needed?
+ </label>
+ <input type="text" name="sample_size" id="sample_size" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="prior_art" class="field_label">
+ If there is prior art or previous results?
+ </label>
+ <div class="field_desc">
+ I.e.,such as testpilot, usertesting.com, field research, etc. Please list it here.
+ </div>
+ <textarea name="prior_art" id="prior_art" rows="10" cols="60"></textarea>
+</div>
+
+<div class="form_section">
+ <label for="test_method" class="field_label required">
+ How do you intend to test your study prior to launch?
+ </label>
+ <div class="field_desc">
+ Moco wide, team only, etc.
+ </div>
+ <input type="text" name="test_method" id="test_method" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="study_length" class="field_label required">
+ How long will your study run?
+ </label>
+ <div class="field_desc">
+ Expected ship dates and field dates.
+ </div>
+ <input type="text" name="study_length" id="study_length" size="60" required="true">
+</div>
+
+<h3>Shipping Status</h3>
+
+<div class="form_section">
+ <label for="targetted_locales" class="field_label required">
+ Targeted locales
+ </label>
+ <input type="text" name="targetted_locales" id="targetted_locales" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="sampling_rates" class="field_label required">
+ Sampling rates
+ </label>
+ <input type="text" name="sampling_rates" id="sampling_rates" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="channels" class="field_label required">
+ Channel(s)
+ </label>
+ <input type="text" name="channels" id="channels" size="60" required="true">
+</div>
+
+<h3>Data Review</h3>
+
+<div class="form_section">
+ <label for="additional_measurements" class="field_label required">
+ If you have extended Telemetry or custom instrumentation, why are you taking these additional measurements?
+ </label>
+ <input type="text" name="additional_measurements" id="additional_measurements" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="third_party_data" class="field_label required">
+ Will your study require third-party data collection?
+ </label>
+ <div class="field_desc">
+ I.e., Google analytics, loggly, any Apache server logs, etc.
+ </div>
+ <input type="text" name="third_party_data" id="third_party_data" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="sample_payload" class="field_label required">
+ Please include a sample payload that your study will submit via Unified Telemetry.
+ </label>
+ <div class="field_desc">
+ This must reside in the /docs/metrics.md of your repository or some similar location (core to the add-on code).
+ </div>
+ <textarea name="sample_payload" id="sample_payload" rows="10" cols="60" required="true"></textarea>
+</div>
+
+<div class="form_section">
+ <label for="data_owner" class="field_label required">
+ Who is the owner of the data analysis for this study?
+ </label>
+ <input type="text" name="data_owner" id="data_owner" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="analysis_plan" class="field_label required">
+ Does your data analyst have an analysis plan?
+ </label>
+ <input type="text" name="analysis_plan" id="analysis_plan" size="60" required="true">
+</div>
+
+<h3>Legal Review</h3>
+
+<div class="form_section">
+ <label for="consent_form" class="field_label required">
+ Please include a link to the consent form.
+ </label>
+ <input type="text" name="consent_form" id="consent_form" size="60" required="true">
+</div>
+
+<div class="form_section">
+ <label for="debrief_survey" class="field_label required">
+ Please include a link to debrief survey.
+ </label>
+ <input type="text" name="debrief_survey" id="debrief_survey" size="60" required="true">
+</div>
+
+<input type="submit" id="commit" value="Submit Request">
+
+</form>
+
+[% PROCESS global/footer.html.tmpl %]
diff --git a/extensions/BMO/web/js/shield_studies.js b/extensions/BMO/web/js/shield_studies.js
new file mode 100644
index 000000000..bffc4f84e
--- /dev/null
+++ b/extensions/BMO/web/js/shield_studies.js
@@ -0,0 +1,15 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This Source Code Form is "Incompatible With Secondary Licenses", as
+ * defined by the Mozilla Public License, v. 2.0. */
+
+$(function() {
+ $('#shieldStudies').submit(function () {
+ var short_desc = '[SHIELD] ' + encodeURIComponent($('#hypothesis').val());
+ console.log(short_desc);
+ $('#short_desc').val(short_desc);
+ return true;
+ });
+});