[Bps-public-commit] rt-extension-announce branch, master, updated. 0.06-4-gdf3cb28
? sunnavy
sunnavy at bestpractical.com
Thu May 23 09:43:30 EDT 2013
The branch, master has been updated
via df3cb285a515062ff5e0d27aeecb85446bb3aceb (commit)
from 60132bc7c96e519375225de9371bbd3e9c64e561 (commit)
Summary of changes:
lib/RT/CustomFieldValues/AnnounceGroups.pm | 40 +++++++++++++++++++++++-------
lib/RT/Extension/Announce.pm | 6 +++++
2 files changed, 37 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit df3cb285a515062ff5e0d27aeecb85446bb3aceb
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu May 23 21:41:19 2013 +0800
add "AnnounceGroups" config to customize groups
diff --git a/lib/RT/CustomFieldValues/AnnounceGroups.pm b/lib/RT/CustomFieldValues/AnnounceGroups.pm
index 6b4e5ad..5a1bd06 100644
--- a/lib/RT/CustomFieldValues/AnnounceGroups.pm
+++ b/lib/RT/CustomFieldValues/AnnounceGroups.pm
@@ -63,15 +63,37 @@ sub ExternalValues {
my @res;
my $i = 0;
- my $groups = RT::Groups->new( $self->CurrentUser );
- $groups->LimitToUserDefinedGroups;
- $groups->OrderByCols( { FIELD => 'Name' } );
- while( my $group = $groups->Next ) {
- push @res, {
- name => $group->Name,
- description => $group->Description,
- sortorder => $i++,
- };
+ my @groups = grep { defined } RT->Config->Get('AnnounceGroups');
+ if ( @groups ) {
+ for my $identifier ( @groups ) {
+ my $group = RT::Group->new($self->CurrentUser);
+ my ( $ret, $msg ) = $group->LoadUserDefinedGroup($identifier);
+ if ( $ret ) {
+ push @res,
+ {
+ name => $group->Name,
+ description => $group->Description,
+ sortorder => $i++,
+ };
+ }
+ else {
+ RT->Logger->warn("Failed to load group $identifier: $msg");
+ }
+ }
+
+ }
+ else {
+ my $groups = RT::Groups->new( $self->CurrentUser );
+ $groups->LimitToUserDefinedGroups;
+ $groups->OrderByCols( { FIELD => 'Name' } );
+ while ( my $group = $groups->Next ) {
+ push @res,
+ {
+ name => $group->Name,
+ description => $group->Description,
+ sortorder => $i++,
+ };
+ }
}
return \@res;
}
diff --git a/lib/RT/Extension/Announce.pm b/lib/RT/Extension/Announce.pm
index fd78541..d837838 100644
--- a/lib/RT/Extension/Announce.pm
+++ b/lib/RT/Extension/Announce.pm
@@ -185,6 +185,12 @@ to your RT_SiteConfig.pm to set that new value:
Set($RTAnnounceQueue, 'Custom Announce Name');
+By default, all the user defined groups will be listed in "Announcement
+Groups", you can customize the group list by setting @AnnounceGroups in
+your RT_SiteConfig.pm:
+
+ Set(@AnnounceGroups, 'foo', 'bar', 'baz');
+
Then clear your mason cache and restart your server.
=head1 AUTHOR
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list