Fix duplicating storages in Posts and subscription groups in threads. Fixes bug #12024.
This commit is contained in:
parent
ebf7763d32
commit
052b3dfd45
5 changed files with 66 additions and 2 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
- fixed #11990: calendar event view
|
- fixed #11990: calendar event view
|
||||||
- fixed #12028: i18n Account_Shop
|
- fixed #12028: i18n Account_Shop
|
||||||
- fixed #11989: calendar list view
|
- fixed #11989: calendar list view
|
||||||
|
- fixed #12024: Copied Collaboration System re-sends subscription mail
|
||||||
|
|
||||||
7.10.7
|
7.10.7
|
||||||
- rfe #10521: Use monospaced font in template edit textarea
|
- rfe #10521: Use monospaced font in template edit textarea
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,26 @@ sub disqualifyAsLastPost {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 duplicate ( )
|
||||||
|
|
||||||
|
Extend the base method to handle duplicate storage locations and groups.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub duplicate {
|
||||||
|
my $self = shift;
|
||||||
|
my $session = $self->session;
|
||||||
|
my $copy = $self->SUPER::duplicate(@_);
|
||||||
|
if ($self->get('storageId')) {
|
||||||
|
my $storage = $self->getStorageLocation;
|
||||||
|
my $copied_storage = $storage->copy;
|
||||||
|
$copy->update({storageId => $copied_storage->getId});
|
||||||
|
}
|
||||||
|
return $copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 DESTROY
|
=head2 DESTROY
|
||||||
|
|
||||||
Extend the base method to delete the locally cached thread object.
|
Extend the base method to delete the locally cached thread object.
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,27 @@ sub DESTROY {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 duplicate
|
||||||
|
|
||||||
|
Extends the base method to handle creating a new subscription group.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub duplicate {
|
||||||
|
my $self = shift;
|
||||||
|
my $session = $self->session;
|
||||||
|
my $copy = $self->SUPER::duplicate(@_);
|
||||||
|
if ($self->get('subscriptionGroupId')) {
|
||||||
|
my $group = WebGUI::Group->new($session, $self->get('subscriptionGroupId'));
|
||||||
|
my $copied_group = WebGUI::Group->new($session, 'new');
|
||||||
|
$copied_group->addUsers($group->getUsers('withoutExpired'));
|
||||||
|
$copy->update({subscriptionGroupId => $copied_group->getId});
|
||||||
|
}
|
||||||
|
return $copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getAdjacentThread ( )
|
=head2 getAdjacentThread ( )
|
||||||
|
|
||||||
Given a field and an order, returns the nearest thread when sorting by those.
|
Given a field and an order, returns the nearest thread when sorting by those.
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use strict;
|
||||||
use lib "$FindBin::Bin/../lib";
|
use lib "$FindBin::Bin/../lib";
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use Test::More tests => 18; # increment this value for each test you create
|
use Test::More tests => 20; # increment this value for each test you create
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
use WebGUI::Asset::Wobject::Collaboration;
|
use WebGUI::Asset::Wobject::Collaboration;
|
||||||
use WebGUI::Asset::Post;
|
use WebGUI::Asset::Post;
|
||||||
|
|
@ -203,4 +203,16 @@ cmp_bag(
|
||||||
'checking attachment loop with multiple attachments for handling of image and non-image types'
|
'checking attachment loop with multiple attachments for handling of image and non-image types'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# duplicate
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
{
|
||||||
|
my $post1_copy = $post1->duplicate;
|
||||||
|
ok $post1_copy->get('storageId'), 'copied post has a storage location';
|
||||||
|
isnt $post1->get('storageId'), $post1_copy->get('storageId'), '... and it is different from the source post';
|
||||||
|
}
|
||||||
|
|
||||||
# vim: syntax=perl filetype=perl
|
# vim: syntax=perl filetype=perl
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use strict;
|
||||||
use lib "$FindBin::Bin/../../lib";
|
use lib "$FindBin::Bin/../../lib";
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use Test::More tests => 15; # increment this value for each test you create
|
use Test::More tests => 17; # increment this value for each test you create
|
||||||
use Test::MockObject::Extends;
|
use Test::MockObject::Extends;
|
||||||
use Test::Exception;
|
use Test::Exception;
|
||||||
use WebGUI::Asset::Wobject::Collaboration;
|
use WebGUI::Asset::Wobject::Collaboration;
|
||||||
|
|
@ -104,4 +104,14 @@ like $thread->getCSLinkUrl, qr/\?pn=5/, 'checking thread on another page, with a
|
||||||
$collab->update({threadsPerPage => 0, postsPerPage => 0,});
|
$collab->update({threadsPerPage => 0, postsPerPage => 0,});
|
||||||
lives_ok { $uncommittedThread->getCSLinkUrl } '... works when pagination set to 0';
|
lives_ok { $uncommittedThread->getCSLinkUrl } '... works when pagination set to 0';
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# duplicate
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
my $thread_copy = $thread->duplicate();
|
||||||
|
ok $thread_copy->get('subscriptionGroupId'), 'duplicate: copied thread got a subscription group';
|
||||||
|
isnt $thread_copy->get('subscriptionGroupId'), $thread->get('subscriptionGroupId'), '... and it is different from the original thread';
|
||||||
|
|
||||||
# vim: syntax=perl filetype=perl
|
# vim: syntax=perl filetype=perl
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue