Make subscribable asset handle its built-in group correctly. Fixes bug#11004
This commit is contained in:
parent
b91a1effa8
commit
56f68bf291
3 changed files with 59 additions and 1 deletions
|
|
@ -51,6 +51,7 @@
|
|||
- fixed #11005: calendar feed workflow
|
||||
- fixed #11008: Test::Class
|
||||
- fixed #11003: Subscribable AssetAspect: no i18n
|
||||
- fixed #11004: Subscribable AssetAspect: handling the subscription group
|
||||
|
||||
7.7.19
|
||||
- fixed #10838: Forwarded forum post email to new CS adds reply to original thread
|
||||
|
|
|
|||
|
|
@ -62,6 +62,23 @@ sub definition {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 duplicate ( [ options ] )
|
||||
|
||||
Subclass the method to create a new group for subscribers for the new asset.
|
||||
|
||||
=cut
|
||||
|
||||
sub duplicate {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $newSelf = $self->next::method( $properties );
|
||||
$newSelf->update({ subscriptionGroupId => '' });
|
||||
$newSelf->createSubscriptionGroup;
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 addRevision ( properties [, revisionDate, options ] )
|
||||
|
||||
Override addRevision to set skipNotification to 0 for each new revision.
|
||||
|
|
@ -405,6 +422,25 @@ sub notifySubscribers {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 purge ( )
|
||||
|
||||
Subclass the method to remove the subscription group.
|
||||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $options = shift;
|
||||
|
||||
my $group = $self->getSubscriptionGroup();
|
||||
$group->delete;
|
||||
$self->next::method($options);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 setSkipNotification ( )
|
||||
|
||||
Set a flag so that this asset does not send out notifications for this
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use lib "$FindBin::Bin/../../../lib";
|
|||
use Test::More;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Group;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -36,7 +37,7 @@ WebGUI::Test->tagsToRollback( WebGUI::VersionTag->getWorking( $session ) );
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 17; # Increment this number for each test you create
|
||||
plan tests => 20; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test subscribable methods
|
||||
|
|
@ -92,6 +93,26 @@ ok( !$new_rev->get('skipNotification'), 'addRevision resets skipNotification to
|
|||
# notify subscribers
|
||||
# subscription content
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# duplication
|
||||
|
||||
my $otherWiki = $wiki->duplicate({ skipAutoCommitWorkflows => 1 });
|
||||
ok($otherWiki->get('subscriptionGroupId'), 'duplicate: duplicated wiki got a subscription group');
|
||||
isnt(
|
||||
$wiki->get('subscriptionGroupId'),
|
||||
$otherWiki->get('subscriptionGroupId'),
|
||||
'and it is a different group from the original wiki'
|
||||
);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# purging
|
||||
|
||||
my $otherGroup = $otherWiki->getSubscriptionGroup();
|
||||
$otherWiki->purge;
|
||||
|
||||
my $groupShouldBeGone = WebGUI::Group->new($session, $otherGroup->getId);
|
||||
is(ref $groupShouldBeGone, '', 'purge: cleaned up the subscription group');
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue