From e4c2bc9969975498f040264cab93479b3bec3bae Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 13 Oct 2005 14:23:27 +0000 Subject: [PATCH] fixed [ 1298851 ] forum subscribers still get notif. after subscr. expired --- docs/changelog/6.x.x.txt | 1 + lib/WebGUI/Asset/Post.pm | 4 ++-- lib/WebGUI/Grouping.pm | 20 ++++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index cdd7687f3..d77b99925 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -6,6 +6,7 @@ - fix [ 1307043 ] Can't Adjust Order of Nav Menu - fix [ 1298896 ] 6.7.4 - reordering stops working after moving assets - fix [ 1324170 ] assetId has no hoverhelp. + - fix [ 1298851 ] forum subscribers still get notif. after subscr. expired 6.7.6 diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index b2cd3f511..300d3a16a 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -585,10 +585,10 @@ Send notifications to the thread and forum subscribers that a new post has been sub notifySubscribers { my $self = shift; my %subscribers; - foreach my $userId (@{WebGUI::Grouping::getUsersInGroup($self->getThread->get("subscriptionGroupId"))}) { + foreach my $userId (@{WebGUI::Grouping::getUsersInGroup($self->getThread->get("subscriptionGroupId"),undef,1)}) { $subscribers{$userId} = $userId unless ($userId eq $self->get("ownerUserId")); } - foreach my $userId (@{WebGUI::Grouping::getUsersInGroup($self->getThread->getParent->get("subscriptionGroupId"))}) { + foreach my $userId (@{WebGUI::Grouping::getUsersInGroup($self->getThread->getParent->get("subscriptionGroupId"),undef,1)}) { $subscribers{$userId} = $userId unless ($userId eq $self->get("ownerUserId")); } my %lang; diff --git a/lib/WebGUI/Grouping.pm b/lib/WebGUI/Grouping.pm index bd76de5ef..a97b8104e 100755 --- a/lib/WebGUI/Grouping.pm +++ b/lib/WebGUI/Grouping.pm @@ -288,7 +288,7 @@ sub getGroupsInGroup { #------------------------------------------------------------------- -=head2 getUsersInGroup ( groupId [, recursive ] ) +=head2 getUsersInGroup ( groupId [, recursive, withoutExpired ] ) Returns an array reference containing a list of users that belong to the specified group. @@ -300,16 +300,28 @@ A unique identifier for the group. A boolean value to determine whether the method should return the users directly in the group or to follow the entire groups of groups hierarchy. Defaults to "0". +=head3 withoutExpired + +A boolean that if set true will return the users list minus the expired groupings. + =cut sub getUsersInGroup { - my $clause = "groupId=".quote($_[0]); - if ($_[1]) { - my $groups = getGroupsInGroup($_[0],1); + my $groupId = shift; + my $recursive = shift; + my $withoutExpired = shift; + my $clause; + if ($withoutExpired) { + $clause = "expireDate > ".time()." and "; + } + $clause .= "(groupId=".quote($groupId); + if ($recursive) { + my $groups = getGroupsInGroup($groupId,1); if ($#$groups >= 0) { $clause .= " or groupId in (".quoteAndJoin($groups).")"; } } + $clause .= ")"; return WebGUI::SQL->buildArrayRef("select userId from groupings where $clause"); }