Update the number of threads in the CS when a thread is archived. Fixes bug #11341.
This commit is contained in:
parent
b5f5f8f6e8
commit
6e0983a67b
4 changed files with 39 additions and 21 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
7.8.10
|
7.8.10
|
||||||
- fixed #11332: Pagination in webgui.org forum urls
|
- fixed #11332: Pagination in webgui.org forum urls
|
||||||
|
- fixed #11341: tmpl_var forum.threads
|
||||||
|
|
||||||
7.8.9
|
7.8.9
|
||||||
- fixed #11235: wiki search
|
- fixed #11235: wiki search
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ sub addRevision {
|
||||||
|
|
||||||
=head2 archive
|
=head2 archive
|
||||||
|
|
||||||
Archives all posts under this thread.
|
Archives all posts under this thread. Update the thread count in the parent CS.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
@ -50,6 +50,8 @@ sub archive {
|
||||||
foreach my $post (@{$self->getPosts}) {
|
foreach my $post (@{$self->getPosts}) {
|
||||||
$post->setStatusArchived;
|
$post->setStatusArchived;
|
||||||
}
|
}
|
||||||
|
my $cs = $self->getParent;
|
||||||
|
$cs->incrementThreads($cs->get("lastPostId"), $cs->get("lastPostDate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,8 @@ our $I18N = {
|
||||||
},
|
},
|
||||||
|
|
||||||
'forum.threads' => {
|
'forum.threads' => {
|
||||||
message => q|The total number of threads in this forum.|,
|
message => q|The total number of threads in this forum. This does not include those that have been archived.|,
|
||||||
lastUpdated => 1149632734,
|
lastUpdated => 1263239637,
|
||||||
},
|
},
|
||||||
|
|
||||||
'forum.url' => {
|
'forum.url' => {
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,15 @@ use WebGUI::Asset::Wobject::Collaboration;
|
||||||
use WebGUI::Asset::Post;
|
use WebGUI::Asset::Post;
|
||||||
use WebGUI::Asset::Wobject::Layout;
|
use WebGUI::Asset::Wobject::Layout;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use Test::More tests => 13; # increment this value for each test you create
|
use Test::More tests => 16; # increment this value for each test you create
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
my @addChildCoda = (undef, undef,
|
||||||
|
{
|
||||||
|
skipAutoCommitWorkflows => 1,
|
||||||
|
skipNotification => 1,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
# Do our work in the import node
|
# Do our work in the import node
|
||||||
my $node = WebGUI::Asset->getImportNode($session);
|
my $node = WebGUI::Asset->getImportNode($session);
|
||||||
|
|
@ -62,26 +68,23 @@ my $props = {
|
||||||
className => 'WebGUI::Asset::Post::Thread',
|
className => 'WebGUI::Asset::Post::Thread',
|
||||||
content => 'hello, world!',
|
content => 'hello, world!',
|
||||||
};
|
};
|
||||||
my $post = $collab->addChild($props,
|
my $thread = $collab->addChild($props, @addChildCoda);
|
||||||
undef,
|
my $tag1 = WebGUI::VersionTag->getWorking($session);
|
||||||
undef,
|
$tag1->commit;
|
||||||
{
|
addToCleanup($tag1);
|
||||||
skipAutoCommitWorkflows => 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
# Test for a sane object type
|
# Test for a sane object type
|
||||||
isa_ok($post, 'WebGUI::Asset::Post::Thread');
|
isa_ok($thread, 'WebGUI::Asset::Post::Thread');
|
||||||
|
|
||||||
$props = {
|
$props = {
|
||||||
className => 'WebGUI::Asset::Post::Thread',
|
className => 'WebGUI::Asset::Post::Thread',
|
||||||
content => 'jello, world!',
|
content => 'jello, world!',
|
||||||
};
|
};
|
||||||
$post = $collab->addChild($props,
|
|
||||||
undef,
|
my $thread2 = $collab->addChild($props, @addChildCoda);
|
||||||
undef,
|
my $tag2 = WebGUI::VersionTag->getWorking($session);
|
||||||
{
|
$tag2->commit;
|
||||||
skipAutoCommitWorkflows => 1,
|
addToCleanup($tag2);
|
||||||
});
|
|
||||||
|
|
||||||
my $rssitems = $collab->getRssFeedItems();
|
my $rssitems = $collab->getRssFeedItems();
|
||||||
is(scalar @{ $rssitems }, 2, 'rssitems set to number of posts added');
|
is(scalar @{ $rssitems }, 2, 'rssitems set to number of posts added');
|
||||||
|
|
@ -97,7 +100,19 @@ addToCleanup(WebGUI::VersionTag->new($session, $dupedCollab->get('tagId')));
|
||||||
ok($dupedCollab->get('getMailCronId'), 'Duplicated CS has a cron job');
|
ok($dupedCollab->get('getMailCronId'), 'Duplicated CS has a cron job');
|
||||||
isnt($dupedCollab->get('getMailCronId'), $collab->get('getMailCronId'), '... and it is different from its source asset');
|
isnt($dupedCollab->get('getMailCronId'), $collab->get('getMailCronId'), '... and it is different from its source asset');
|
||||||
|
|
||||||
TODO: {
|
note "Thread and Post count tests";
|
||||||
local $TODO = "Tests to make later";
|
$collab = $collab->cloneFromDb;
|
||||||
ok(0, 'A whole lot more work to do here');
|
is $collab->get('threads'), 2, 'CS has 2 thread';
|
||||||
}
|
is $collab->get('replies'), 0, '... and no replies (posts)';
|
||||||
|
|
||||||
|
$thread2->archive();
|
||||||
|
$collab = $collab->cloneFromDb;
|
||||||
|
is $collab->get('threads'), 1, 'CS lost 1 thread due to archiving';
|
||||||
|
|
||||||
|
my $thread3 = $collab->addChild($props, @addChildCoda);
|
||||||
|
my $tag3 = WebGUI::VersionTag->getWorking($session);
|
||||||
|
$tag3->commit;
|
||||||
|
addToCleanup($tag3);
|
||||||
|
$collab = $collab->cloneFromDb;
|
||||||
|
is $collab->get('threads'), 2, '... added 1 thread';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue