Fix bug 11098. Create a VersionTag method that only clear the session for a single user.
This commit is contained in:
parent
5f29c5bcdd
commit
a866f143d0
4 changed files with 49 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
7.8.2
|
||||
- fixed #11098: Leaving a version tag makes everyone leave
|
||||
|
||||
7.8.1
|
||||
- mark $session->datetime->time as deprecated and remove its use from core code
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ A reference to the current session.
|
|||
|
||||
sub www_leaveVersionTag {
|
||||
my $session = shift;
|
||||
WebGUI::VersionTag->getWorking($session)->clearWorking;
|
||||
WebGUI::VersionTag->getWorking($session)->leaveTag;
|
||||
return www_manageVersions($session);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -515,6 +515,20 @@ sub getWorking {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 leaveTag ( )
|
||||
|
||||
Make the user leave their current tag.
|
||||
|
||||
=cut
|
||||
|
||||
sub leaveTag {
|
||||
my $self = shift;
|
||||
$self->session->scratch->delete('versionTag');
|
||||
$self->session->stow->delete("versionTag");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 lock ( )
|
||||
|
||||
Sets this version tag up so no more revisions may be applied to it.
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use lib "$FindBin::Bin/lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::VersionTag;
|
||||
use Test::More tests => 68; # increment this value for each test you create
|
||||
use Test::More tests => 74; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -379,6 +379,38 @@ $adminUserTag->rollback();
|
|||
setSiteVersionTagMode($session, q{multiPerUser});
|
||||
setUserVersionTagMode($user, q{inherited});
|
||||
|
||||
my $andySession = WebGUI::Test->newSession();
|
||||
my $redSession = WebGUI::Test->newSession();
|
||||
|
||||
my $andy = WebGUI::User->create($andySession);
|
||||
my $red = WebGUI::User->create($redSession);
|
||||
addToCleanup($andy, $red);
|
||||
|
||||
my $andyTag = WebGUI::VersionTag->getWorking($andySession);
|
||||
addToCleanup($andyTag);
|
||||
my $redTag = WebGUI::VersionTag->new($redSession, $andyTag->getId);
|
||||
$redTag->setWorking();
|
||||
is($andyTag->getId, $redTag->getId, 'users share the same version tag');
|
||||
|
||||
$andyTag->leaveTag;
|
||||
{
|
||||
my $andyTagCheck = WebGUI::VersionTag->getWorking($andySession, 'nocreate');
|
||||
is($andyTagCheck, undef, 'leaveTag: user andy does not have tag');
|
||||
my $redTagCheck = WebGUI::VersionTag->getWorking($redSession, 'nocreate');
|
||||
isa_ok($redTagCheck, 'WebGUI::VersionTag', '... user red does');
|
||||
is($redTagCheck->getId, $redTag->getId, '... user red still has the same tag as before');
|
||||
}
|
||||
|
||||
my $andyTag2 = WebGUI::VersionTag->new($session, $redTag->getId);
|
||||
$andyTag2->clearWorking;
|
||||
{
|
||||
my $andyTagCheck = WebGUI::VersionTag->getWorking($andySession, 'nocreate');
|
||||
is($andyTagCheck, undef, 'clearWorking: user andy does not have tag');
|
||||
my $redSession2 = $redSession->duplicate;
|
||||
addToCleanup($redSession2);
|
||||
my $redTagCheck = WebGUI::VersionTag->getWorking($redSession2, 'nocreate');
|
||||
is($redTagCheck, undef, 'red does not either');
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# mode: cperl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue