开发者

How do I automatically change the assignee of a bug back to the reporter when a bug is marked RESOLVED?

开发者 https://www.devze.com 2023-01-07 20:26 出处:网络
We have a workflow where all incoming bugs are marked ASSIGNED to their product\'s default assignee, then they stay in ASSIGNED until RESOLVED by the a开发者_JAVA技巧ssignee.

We have a workflow where all incoming bugs are marked ASSIGNED to their product's default assignee, then they stay in ASSIGNED until RESOLVED by the a开发者_JAVA技巧ssignee.

At that point, they go either from RESOLVED back to ASSIGNED (e.g. not done yet) or to CLOSED once they reporter is satisfied.

How do we automatically change the assignee of the bug to the reporter when the first assignee marks it RESOLVED?


Actually, this is pretty easy with Bugzilla hooks. Where the extension code needs to go will depend on what version you are using, because this is a capability that's rapidly developing.

In Bugzilla 3.6.1, the current version, if you wanted to call your extension Local, you would create a file extensions/Local/Extension.pm.

http://www.bugzilla.org/docs/3.6/en/html/api/Bugzilla/Extension.html is the overview of the whole extension system.

The hook you want to use for this is bug_end_of_update, which is called in Bugzilla/Bug.pm after the object is changed but before it is written to the database.

For what you're doing, you should probably check changes to see whether bug_status has changed. If so, update bug to set the owner to the reporter, and add that change to changes.

The main developers of Bugzilla can usually be found on #mozwebtools on irc.mozilla.org, drop in and chat them up about the particulars if my answer isn't enough to get you rolling.


This will work: (CustomExtension.pm)

package Bugzilla::Extension::CustomExtension;
use strict;
use base qw(Bugzilla::Extension);

our $VERSION = '1.0';
use constant NAME => 'CustomExtension';

sub object_end_of_set_all {
    my ($self, $args) = @_;

    my $object = $args->{'object'};

    if ($object->isa('Bugzilla::Bug')) {
        if ($object->{'bug_status'} eq 'RESOLVED') {            # Bug has been RESOLVED
            $object->{'assigned_to'} = $object->{'reporter_id'};    # re-assign to Reporter
        }
    }
}

__PACKAGE__->NAME;
0

精彩评论

暂无评论...
验证码 换一张
取 消