Revert "group() function Survey::ExpressionEngine that returns 1/0 depending on whether the current user is in a group" -- wrong branch.
This reverts commit eaa29c5f44.
Conflicts:
docs/changelog/7.x.x.txt
This commit is contained in:
parent
3fe8f9a080
commit
0422807b32
3 changed files with 1 additions and 38 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
7.10.25
|
7.10.25
|
||||||
- fixed: if user1 adds user2 as a friend, user2 doesn't see user1 as a friend
|
- fixed: if user1 adds user2 as a friend, user2 doesn't see user1 as a friend
|
||||||
- fixed: data sync bug in WebGUI::User::friends
|
- fixed: data sync bug in WebGUI::User::friends
|
||||||
- added: group() function for Survey::ExpressionEngine to test group membership
|
|
||||||
- added: give WebGUI::PseudoRequest a hostname method
|
- added: give WebGUI::PseudoRequest a hostname method
|
||||||
- fixed: don't clobber the request handler if WebGUI::Test was loaded inside of mod_perl
|
- fixed: don't clobber the request handler if WebGUI::Test was loaded inside of mod_perl
|
||||||
- fixed #12365: editing a metadata may cause a fatal error (Arjan Widlak / United Knowledge)
|
- fixed #12365: editing a metadata may cause a fatal error (Arjan Widlak / United Knowledge)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ my $validate;
|
||||||
my $validTargets;
|
my $validTargets;
|
||||||
my $otherInstances;
|
my $otherInstances;
|
||||||
my $tags;
|
my $tags;
|
||||||
my $groups;
|
|
||||||
|
|
||||||
=head2 value
|
=head2 value
|
||||||
|
|
||||||
|
|
@ -353,24 +352,6 @@ sub avg {
|
||||||
return sum(@vals) / @vals;
|
return sum(@vals) / @vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
=head2 group ($name)
|
|
||||||
|
|
||||||
Utility sub that returns a boolean indicating whether the user taking the survey is a member of a specified group, by name
|
|
||||||
|
|
||||||
=head3 $name
|
|
||||||
|
|
||||||
The name of the group
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub group {
|
|
||||||
my ($name) = @_;
|
|
||||||
my $value = grep( $_ eq $name, @$groups ) ? 1 : 0;
|
|
||||||
# warn "group($name) resolves to [$value]; groups = " . join( " ", map ">>$_<<", @$groups ) . " for userId " . $session->user->getId;
|
|
||||||
$session->log->debug("group($name) resolves to [$value]; groups = @$groups");
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 round
|
=head2 round
|
||||||
|
|
||||||
Utility sub shared with Safe compartment to allows expressions to easily round numbers
|
Utility sub shared with Safe compartment to allows expressions to easily round numbers
|
||||||
|
|
@ -461,15 +442,6 @@ sub run {
|
||||||
$validTargets = $opts->{validTargets};
|
$validTargets = $opts->{validTargets};
|
||||||
$tags = $opts->{tags} || {};
|
$tags = $opts->{tags} || {};
|
||||||
$otherInstances = {};
|
$otherInstances = {};
|
||||||
$groups = $session->db->buildArrayRef( qq{
|
|
||||||
select groupName
|
|
||||||
from groupings
|
|
||||||
join groups using (groupId)
|
|
||||||
where groupings.userId = ?
|
|
||||||
and expireDate > now()
|
|
||||||
}, [
|
|
||||||
$session->user->getId,
|
|
||||||
] );
|
|
||||||
|
|
||||||
if ( !$session->config->get('enableSurveyExpressionEngine') ) {
|
if ( !$session->config->get('enableSurveyExpressionEngine') ) {
|
||||||
$session->log->debug('enableSurveyExpressionEngine config option disabled, skipping');
|
$session->log->debug('enableSurveyExpressionEngine config option disabled, skipping');
|
||||||
|
|
@ -497,7 +469,6 @@ sub run {
|
||||||
$compartment->share('&restart');
|
$compartment->share('&restart');
|
||||||
$compartment->share('&avg');
|
$compartment->share('&avg');
|
||||||
$compartment->share('&round');
|
$compartment->share('&round');
|
||||||
$compartment->share('&group');
|
|
||||||
|
|
||||||
# Give them all of List::Util too
|
# Give them all of List::Util too
|
||||||
$compartment->share_from( 'List::Util',
|
$compartment->share_from( 'List::Util',
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
my $tests = 62;
|
my $tests = 60;
|
||||||
plan tests => $tests + 1;
|
plan tests => $tests + 1;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -237,13 +237,6 @@ cmp_deeply( $e->run( $session, qq{jump {scoreX('$url', ext_s0) == 200} target},
|
||||||
cmp_deeply( $e->run( $session, qq{jump {taggedX('$url', ext_tag) == 199} target}, {userId => $user->userId} ),
|
cmp_deeply( $e->run( $session, qq{jump {taggedX('$url', ext_tag) == 199} target}, {userId => $user->userId} ),
|
||||||
{ jump => 'target', tags => {} }, 'external tag lookups work too' );
|
{ jump => 'target', tags => {} }, 'external tag lookups work too' );
|
||||||
|
|
||||||
# group() utility function
|
|
||||||
$session->user( { userId => 3 });
|
|
||||||
cmp_deeply( $e->run( $session, qq{jump { group('Admins') } target}, ),
|
|
||||||
{ jump => 'target', tags => { }, }, 'group() function recognizes us as Admins' );
|
|
||||||
cmp_deeply( $e->run( $session, qq{jump { group('Space Aliens') } target}, ),
|
|
||||||
{ jump => undef, tags => { }, }, 'group() function recognizes that we are not Space Aliens' );
|
|
||||||
|
|
||||||
# Test for nasty bugs caused by file-scoped lexicals not being properly initialised in L<ExpressionEngine::run>
|
# Test for nasty bugs caused by file-scoped lexicals not being properly initialised in L<ExpressionEngine::run>
|
||||||
{
|
{
|
||||||
# Create a second test user
|
# Create a second test user
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue