summaryrefslogtreecommitdiffstats
path: root/extensions/FlagTypeComment
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2011-12-21 17:21:47 +0100
committerByron Jones <bjones@mozilla.com>2011-12-21 17:21:47 +0100
commit5cbb1c79abf94ffdd55f554c910da64cd9782503 (patch)
treeefc40914c30e77a900d7d5a097d71ce423989758 /extensions/FlagTypeComment
parentd20a2efc289fefaba0f256d46a3bab7fc24bd66b (diff)
downloadbugzilla-5cbb1c79abf94ffdd55f554c910da64cd9782503.tar.gz
bugzilla-5cbb1c79abf94ffdd55f554c910da64cd9782503.tar.xz
Bug 712327: fix issue in FlagTypeComment when editing flags
Diffstat (limited to 'extensions/FlagTypeComment')
-rw-r--r--extensions/FlagTypeComment/Extension.pm18
1 files changed, 13 insertions, 5 deletions
diff --git a/extensions/FlagTypeComment/Extension.pm b/extensions/FlagTypeComment/Extension.pm
index 4c1b5cc05..4b5ef5510 100644
--- a/extensions/FlagTypeComment/Extension.pm
+++ b/extensions/FlagTypeComment/Extension.pm
@@ -22,11 +22,12 @@ package Bugzilla::Extension::FlagTypeComment;
use strict;
use base qw(Bugzilla::Extension);
-use Bugzilla::FlagType;
-use Bugzilla::Util 'trick_taint';
-
use Bugzilla::Extension::FlagTypeComment::Constants;
+use Bugzilla::FlagType;
+use Bugzilla::Util qw(trick_taint);
+use Scalar::Util qw(blessed);
+
our $VERSION = '1';
################
@@ -83,7 +84,14 @@ sub _set_ftc_states {
if ($file =~ /^admin\//) {
# admin
my $type = $vars->{'type'} || return;
- if ($type->target_type eq 'bug') {
+ my ($target_type, $id);
+ if (blessed($type)) {
+ ($target_type, $id) = ($type->target_type, $type->id);
+ } else {
+ ($target_type, $id) = ($type->{target_type}, $type->{id});
+ trick_taint($id);
+ }
+ if ($target_type eq 'bug') {
return unless FLAGTYPE_COMMENT_BUG_FLAGS;
} else {
return unless FLAGTYPE_COMMENT_ATTACHMENT_FLAGS;
@@ -93,7 +101,7 @@ sub _set_ftc_states {
FROM flagtype_comments WHERE type_id=?",
'state',
undef,
- $type->id);
+ $id);
} else {
# creating/editing attachment / viewing bug