From: Dylan William Hardison Date: Wed, 3 Apr 2019 19:29:46 +0000 (-0400) Subject: no bug - remove useless "file a bug if a field was changed" code (#1191) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5adaece52849c7e4b6f1c9c938b9caa9f0e2b0e0;p=thirdparty%2Fbugzilla.git no bug - remove useless "file a bug if a field was changed" code (#1191) For some historical reason, we had code to file a bug when a new field was added. This is bad for a number of obvious reasons: 1. It hard-codes a domain name check 2. It hard-codes a product and component (which don't exist) 3. It hints that it is *acceptable* to allow different systems to have direct access to BMO's DB, which is not the case. In short, this code should go. --- diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 3615b29d1..e618e83ef 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -1575,87 +1575,6 @@ sub _last_closed_date { return $self->{'last_closed_date'}; } -sub field_end_of_create { - my ($self, $args) = @_; - my $field = $args->{'field'}; - - # Create an IT bug so Mozilla's DBAs so they can update the grants for metrics - - if ( Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.mozilla.org/' - && Bugzilla->localconfig->{'urlbase'} ne 'https://bugzilla.allizom.org/') - { - return; - } - - my $name = $field->name; - - if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) { - Bugzilla->set_user(Bugzilla::User->check({name => 'nobody@mozilla.org'})); - print "Creating IT permission grant bug for new field '$name'..."; - } - - my $bug_data = { - short_desc => "Custom field '$name' added to bugzilla.mozilla.org", - product => 'Data & BI Services Team', - component => 'Database Operations', - bug_type => 'task', - bug_severity => 'normal', - op_sys => 'All', - rep_platform => 'All', - version => 'other', - }; - - my $comment = <type == FIELD_TYPE_SINGLE_SELECT - || $field->type == FIELD_TYPE_MULTI_SELECT) - { - $comment .= <type == FIELD_TYPE_MULTI_SELECT) { - $comment .= <type != FIELD_TYPE_MULTI_SELECT) { - $comment .= <{'comment'} = $comment; - - my $old_error_mode = Bugzilla->error_mode; - Bugzilla->error_mode(ERROR_MODE_DIE); - - my $new_bug = eval { Bugzilla::Bug->create($bug_data) }; - - my $error = $@; - undef $@; - Bugzilla->error_mode($old_error_mode); - - if ($error || !($new_bug && $new_bug->{'bug_id'})) { - warn "Error creating IT bug for new field $name: $error"; - if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) { - print "\nError: $error\n"; - } - } - else { - Bugzilla::BugMail::Send($new_bug->id, {changer => Bugzilla->user}); - if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) { - print "bug " . $new_bug->id . " created.\n"; - } - } -} - sub webservice { my ($self, $args) = @_;