summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib/Data.pm
blob: 4f158e295f639d6f60381a6a522eb81db0d2914e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# 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.

package Bugzilla::Extension::BMO::Data;
use strict;

use base qw(Exporter);
use Tie::IxHash;

our @EXPORT = qw( $cf_visible_in_products
                  %group_change_notification
                  $cf_setters
                  @always_fileable_groups
                  %group_auto_cc
                  %create_bug_formats
                  @default_named_queries
                  %autodetect_attach_urls );

# Creating an attachment whose contents is a URL matching one of these regexes
# will result in the user being redirected to that URL when viewing the
# attachment.
our %autodetect_attach_urls = (
    github_pr => {
        title        => 'GitHub Pull Request',
        regex        => qr#^https://github\.com/[^/]+/[^/]+/pull/\d+/?$#i,
        content_type => 'text/x-github-pull-request',
    },
    reviewboard => {
        title        => 'MozReview',
        regex        => qr#^https?://reviewboard(?:-dev)?\.(?:allizom|mozilla)\.org/r/\d+/?#i,
        content_type => 'text/x-review-board-request',
    },
    google_docs => {
        title        => 'Google Doc',
        regex        => qr#^https://docs\.google\.com/(?:document|spreadsheets|presentation)/d/#i,
        content_type => 'text/x-google-doc',
    },
);

# Which custom fields are visible in which products and components.
#
# By default, custom fields are visible in all products. However, if the name
# of the field matches any of these regexps, it is only visible if the
# product (and component if necessary) is a member of the attached hash. []
# for component means "all".
#
# IxHash keeps them in insertion order, and so we get regexp priorities right.
our $cf_visible_in_products;
tie(%$cf_visible_in_products, "Tie::IxHash",
    qr/^cf_colo_site$/ => {
        "mozilla.org" => [
            "Server Operations",
            "Server Operations: DCOps",
            "Server Operations: Projects",
            "Server Operations: RelEng",
            "Server Operations: Security",
        ],
        "Infrastructure & Operations" => [
            "RelOps",
            "RelOps: Puppet",
            "DCOps",
        ],
    },
    qr/^cf_office$/ => {
        "mozilla.org" => ["Server Operations: Desktop Issues"],
    },
    qr/^cf_crash_signature$/ => {
        "Add-on SDK"                  => [],
        "addons.mozilla.org"          => [],
        "Android Background Services" => [],
        "Calendar"                    => [],
        "Camino"                      => [],
        "Composer"                    => [],
        "Core"                        => [],
        "Directory"                   => [],
        "Fennec"                      => [],
        "Firefox"                     => [],
        "Firefox for Android"         => [],
        "Firefox for Metro"           => [],
        "Firefox OS"                  => [],
        "JSS"                         => [],
        "MailNews Core"               => [],
        "Mozilla Labs"                => [],
        "Mozilla Localizations"       => [],
        "mozilla.org"                 => [],
        "Cloud Services"              => [],
        "NSPR"                        => [],
        "NSS"                         => [],
        "Other Applications"          => [],
        "Penelope"                    => [],
        "Plugins"                     => [],
        "Release Engineering"         => [],
        "Rhino"                       => [],
        "SeaMonkey"                   => [],
        "Tamarin"                     => [],
        "Tech Evangelism"             => [],
        "Testing"                     => [],
        "Thunderbird"                 => [],
        "Toolkit"                     => [],
    },
    qr/^cf_due_date$/ => {
        "bugzilla.mozilla.org"        => [],
        "Community Building"          => [],
        "Data & BI Services Team"     => [],
        "Data Compliance"             => [],
        "Developer Engagement"        => [],
        "Infrastructure & Operations" => [],
        "Marketing"                   => [],
        "mozilla.org"                 => ["Security Assurance: Review Request"],
        "Mozilla Metrics"             => [],
        "Mozilla PR"                  => [],
        "Mozilla Reps"                => [],
    },
    qr/^cf_locale$/ => {
        "Mozilla Localizations" => ['Other'],
        "www.mozilla.org"       => [],
    },
    qr/^cf_mozilla_project$/ => {
        "Data & BI Services Team" => [],
    },
    qr/^cf_machine_state$/ => {
        "Release Engineering" => ["Buildduty"],
    },
    qr/^cf_rank$/ => {
        "Core"                => [],
        "Firefox for Android" => [],
        "Firefox for iOS"     => [],
        "Firefox"             => [],
        "Hello (Loop)"        => [],
        "Cloud Services"      => [],
        "Toolkit"             => [],
    },
    qr/^cf_has_regression_range$/ => {
        "Core"    => [],
        "Firefox" => [],
        "Toolkit" => [],
    },
    qr/^cf_has_str$/ => {
        "Core"    => [],
        "Firefox" => [],
        "Toolkit" => [],
    },
);

# Who to CC on particular bugmails when certain groups are added or removed.
our %group_change_notification = (
  'addons-security'           => ['amo-editors@mozilla.org'],
  'b2g-core-security'         => ['security@mozilla.org'],
  'bugzilla-security'         => ['security@bugzilla.org'],
  'client-services-security'  => ['amo-admins@mozilla.org', 'web-security@mozilla.org'],
  'cloud-services-security'   => ['web-security@mozilla.org'],
  'core-security'             => ['security@mozilla.org'],
  'crypto-core-security'      => ['security@mozilla.org'],
  'dom-core-security'         => ['security@mozilla.org'],
  'firefox-core-security'     => ['security@mozilla.org'],
  'gfx-core-security'         => ['security@mozilla.org'],
  'javascript-core-security'  => ['security@mozilla.org'],
  'layout-core-security'      => ['security@mozilla.org'],
  'mail-core-security'        => ['security@mozilla.org'],
  'media-core-security'       => ['security@mozilla.org'],
  'network-core-security'     => ['security@mozilla.org'],
  'release-core-security'     => ['security@mozilla.org'],
  'tamarin-security'          => ['tamarinsecurity@adobe.com'],
  'toolkit-core-security'     => ['security@mozilla.org'],
  'websites-security'         => ['web-security@mozilla.org'],
  'webtools-security'         => ['web-security@mozilla.org'],
);

# Who can set custom flags (use full field names only, not regex's)
our $cf_setters = {
    'cf_colo_site'  => [ 'infra', 'build' ],
    'cf_rank'       => [ 'rank-setters' ],
};

# Groups in which you can always file a bug, regardless of product or user.
our @always_fileable_groups = qw(
    addons-security
    bugzilla-security
    client-services-security
    consulting
    core-security
    finance
    infra
    infrasec
    l20n-security
    marketing-private
    mozilla-confidential
    mozilla-employee-confidential
    mozilla-foundation-confidential
    mozilla-engagement
    mozilla-messaging-confidential
    partner-confidential
    payments-confidential
    tamarin-security
    websites-security
    webtools-security
);

# Automatically CC users to bugs filed into configured groups and products
our %group_auto_cc = (
    'partner-confidential' => {
        'Marketing' => ['jbalaco@mozilla.com'],
        '_default'  => ['mbest@mozilla.com'],
    },
);

# Force create-bug template by product
# Users in 'include' group will be forced into using the form.
our %create_bug_formats = (
    'Data Compliance' => {
        'format'  => 'data-compliance',
        'include' => 'everyone',
    },
    'Mozilla Developer Network' => {
        'format'  => 'mdn',
        'include' => 'everyone',
    },
    'Legal' => {
        'format'  => 'legal',
        'include' => 'everyone',
    },
    'Recruiting' => {
        'format' => 'recruiting',
        'include' => 'everyone',
    },
    'Internet Public Policy' => {
        'format'  => 'ipp',
        'include' => 'everyone',
    },
);

# List of named queries which will be added to new users' footer
our @default_named_queries = (
    {
        name  => 'Bugs Filed Today',
        query => 'query_format=advanced&chfieldto=Now&chfield=[Bug creation]&chfieldfrom=-24h&order=bug_id',
    },
);

1;