From 0677733f0afbf6e4b5b414e8ae928dea34bff893 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Fri, 22 May 2015 13:33:40 +0800 Subject: Bug 1135164: display a warning on show_bug when an unassigned bug has a patch attached --- extensions/BMO/Extension.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'extensions/BMO/Extension.pm') diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 02824f471..1c25da749 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -65,6 +65,8 @@ our $VERSION = '0.1'; BEGIN { *Bugzilla::Bug::last_closed_date = \&_last_closed_date; *Bugzilla::Bug::reporters_hw_os = \&_bug_reporters_hw_os; + *Bugzilla::Bug::is_unassigned = \&_bug_is_unassigned; + *Bugzilla::Bug::has_patch = \&_bug_has_patch; *Bugzilla::Product::default_security_group = \&_default_security_group; *Bugzilla::Product::default_security_group_obj = \&_default_security_group_obj; *Bugzilla::Product::group_always_settable = \&_group_always_settable; @@ -761,6 +763,23 @@ sub _bug_reporters_hw_os { return $self->{ua_hw_os} = $hw_os; } +sub _bug_is_unassigned { + my ($self) = @_; + my $assignee = $self->assigned_to->login; + return $assignee eq 'nobody@mozilla.org' || $assignee =~ /\.bugs$/; +} + +sub _bug_has_patch { + my ($self) = @_; + foreach my $attachment (@{ $self->attachments }) { + return 1 if + $attachment->ispatch + || $attachment->contenttype eq 'text/x-github-pull-request' + || $attachment->contenttype eq 'text/x-review-board-request'; + } + return 0; +} + sub _product_default_platform_id { $_[0]->{default_platform_id} } sub _product_default_op_sys_id { $_[0]->{default_op_sys_id} } -- cgit v1.2.3-24-g4f1b