summaryrefslogtreecommitdiffstats
path: root/extensions/RestrictComments
diff options
context:
space:
mode:
authorPerl Tidy <perltidy@bugzilla.org>2018-12-05 21:38:52 +0100
committerDylan William Hardison <dylan@hardison.net>2018-12-05 23:49:08 +0100
commit8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch)
tree9d270f173330ca19700e0ba9f2ee931300646de1 /extensions/RestrictComments
parenta7bb5a65b71644d9efce5fed783ed545b9336548 (diff)
downloadbugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz
bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'extensions/RestrictComments')
-rw-r--r--extensions/RestrictComments/Config.pm2
-rw-r--r--extensions/RestrictComments/Extension.pm98
-rw-r--r--extensions/RestrictComments/lib/Config.pm40
3 files changed, 71 insertions, 69 deletions
diff --git a/extensions/RestrictComments/Config.pm b/extensions/RestrictComments/Config.pm
index be703bed7..eb99e5a94 100644
--- a/extensions/RestrictComments/Config.pm
+++ b/extensions/RestrictComments/Config.pm
@@ -11,7 +11,7 @@ use 5.10.1;
use strict;
use warnings;
-use constant NAME => 'RestrictComments';
+use constant NAME => 'RestrictComments';
use constant REQUIRED_MODULES => [];
use constant OPTIONAL_MODULES => [];
diff --git a/extensions/RestrictComments/Extension.pm b/extensions/RestrictComments/Extension.pm
index e93540d5a..83075ac23 100644
--- a/extensions/RestrictComments/Extension.pm
+++ b/extensions/RestrictComments/Extension.pm
@@ -17,84 +17,86 @@ use Bugzilla::Constants;
use Bugzilla::Util qw(i_am_webservice);
BEGIN {
- *Bugzilla::Bug::restrict_comments = \&_bug_restrict_comments;
+ *Bugzilla::Bug::restrict_comments = \&_bug_restrict_comments;
}
sub _bug_restrict_comments {
- my ($self) = @_;
- return $self->{restrict_comments};
+ my ($self) = @_;
+ return $self->{restrict_comments};
}
sub bug_check_can_change_field {
- my ($self, $args) = @_;
- my ($bug, $priv_results) = @$args{qw(bug priv_results)};
- my $user = Bugzilla->user;
-
- if ($user->id
- && $bug->restrict_comments
- && !$user->in_group(Bugzilla->params->{'restrict_comments_group'}))
- {
- push(@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED);
- return;
- }
+ my ($self, $args) = @_;
+ my ($bug, $priv_results) = @$args{qw(bug priv_results)};
+ my $user = Bugzilla->user;
+
+ if ( $user->id
+ && $bug->restrict_comments
+ && !$user->in_group(Bugzilla->params->{'restrict_comments_group'}))
+ {
+ push(@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED);
+ return;
+ }
}
sub _can_restrict_comments {
- my ($self, $object) = @_;
- return unless $object->isa('Bugzilla::Bug');
- $self->{setter_group} ||= Bugzilla->params->{'restrict_comments_enable_group'};
- return Bugzilla->user->in_group($self->{setter_group});
+ my ($self, $object) = @_;
+ return unless $object->isa('Bugzilla::Bug');
+ $self->{setter_group} ||= Bugzilla->params->{'restrict_comments_enable_group'};
+ return Bugzilla->user->in_group($self->{setter_group});
}
sub object_end_of_set_all {
- my ($self, $args) = @_;
- my $object = $args->{object};
- my $input = Bugzilla->input_params;
- my $update_restrict_comments = !i_am_webservice() || exists $input->{restrict_comments};
- if ($update_restrict_comments && $self->_can_restrict_comments($object)) {
- $object->set('restrict_comments', $input->{restrict_comments} ? 1 : undef);
- }
+ my ($self, $args) = @_;
+ my $object = $args->{object};
+ my $input = Bugzilla->input_params;
+ my $update_restrict_comments
+ = !i_am_webservice() || exists $input->{restrict_comments};
+ if ($update_restrict_comments && $self->_can_restrict_comments($object)) {
+ $object->set('restrict_comments', $input->{restrict_comments} ? 1 : undef);
+ }
}
sub object_update_columns {
- my ($self, $args) = @_;
- my ($object, $columns) = @$args{qw(object columns)};
- if ($self->_can_restrict_comments($object)) {
- push(@$columns, 'restrict_comments');
- }
+ my ($self, $args) = @_;
+ my ($object, $columns) = @$args{qw(object columns)};
+ if ($self->_can_restrict_comments($object)) {
+ push(@$columns, 'restrict_comments');
+ }
}
sub object_columns {
- my ($self, $args) = @_;
- my ($class, $columns) = @$args{qw(class columns)};
- if ($class->isa('Bugzilla::Bug')) {
- if (Bugzilla->dbh->bz_column_info($class->DB_TABLE, 'restrict_comments')) {
- push @$columns, 'restrict_comments';
- }
+ my ($self, $args) = @_;
+ my ($class, $columns) = @$args{qw(class columns)};
+ if ($class->isa('Bugzilla::Bug')) {
+ if (Bugzilla->dbh->bz_column_info($class->DB_TABLE, 'restrict_comments')) {
+ push @$columns, 'restrict_comments';
}
+ }
}
sub bug_fields {
- my ($self, $args) = @_;
- my $fields = $args->{'fields'};
- push (@$fields, 'restrict_comments')
+ my ($self, $args) = @_;
+ my $fields = $args->{'fields'};
+ push(@$fields, 'restrict_comments');
}
sub config_add_panels {
- my ($self, $args) = @_;
- my $modules = $args->{panel_modules};
- $modules->{RestrictComments} = "Bugzilla::Extension::RestrictComments::Config";
+ my ($self, $args) = @_;
+ my $modules = $args->{panel_modules};
+ $modules->{RestrictComments} = "Bugzilla::Extension::RestrictComments::Config";
}
sub install_update_db {
- my $dbh = Bugzilla->dbh;
+ my $dbh = Bugzilla->dbh;
- my $field = new Bugzilla::Field({ name => 'restrict_comments' });
- if (!$field) {
- Bugzilla::Field->create({ name => 'restrict_comments', description => 'Restrict Comments' });
- }
+ my $field = new Bugzilla::Field({name => 'restrict_comments'});
+ if (!$field) {
+ Bugzilla::Field->create(
+ {name => 'restrict_comments', description => 'Restrict Comments'});
+ }
- $dbh->bz_add_column('bugs', 'restrict_comments', { TYPE => 'BOOLEAN' });
+ $dbh->bz_add_column('bugs', 'restrict_comments', {TYPE => 'BOOLEAN'});
}
__PACKAGE__->NAME;
diff --git a/extensions/RestrictComments/lib/Config.pm b/extensions/RestrictComments/lib/Config.pm
index e5dbc518c..c1f9829f9 100644
--- a/extensions/RestrictComments/lib/Config.pm
+++ b/extensions/RestrictComments/lib/Config.pm
@@ -17,26 +17,26 @@ use Bugzilla::Group;
our $sortkey = 510;
sub get_param_list {
- my ($class) = @_;
-
- my @param_list = (
- {
- name => 'restrict_comments_group',
- type => 's',
- choices => \&get_all_group_names,
- default => '',
- checker => \&check_group
- },
- {
- name => 'restrict_comments_enable_group',
- type => 's',
- choices => \&get_all_group_names,
- default => '',
- checker => \&check_group
- },
- );
-
- return @param_list;
+ my ($class) = @_;
+
+ my @param_list = (
+ {
+ name => 'restrict_comments_group',
+ type => 's',
+ choices => \&get_all_group_names,
+ default => '',
+ checker => \&check_group
+ },
+ {
+ name => 'restrict_comments_enable_group',
+ type => 's',
+ choices => \&get_all_group_names,
+ default => '',
+ checker => \&check_group
+ },
+ );
+
+ return @param_list;
}
1;