Normalized signature of Asset::duplicate. This involved going through
existing overrides and callers for that method and making sure they followed the correct signature. Various related cleanups. This should fix those bugs with collaboration systems refusing to be copied or deployed as packages.
This commit is contained in:
parent
3f45819b49
commit
c438d55310
20 changed files with 123 additions and 153 deletions
|
|
@ -26,9 +26,7 @@ our @ISA = qw(WebGUI::Asset::Post);
|
|||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
if ($newSelf->get("subscriptionGroupId") eq "") {
|
||||
$newSelf->createSubscriptionGroup;
|
||||
}
|
||||
$newSelf->createSubscriptionGroup;
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +60,22 @@ sub commit {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Override duplicateBranch here so that new posts get their threadId set correctly.
|
||||
# Buggo: should this be part of the addRevision override instead?
|
||||
|
||||
sub duplicateBranch {
|
||||
my $self = shift;
|
||||
my $newAsset = $self->SUPER::duplicateBranch(@_);
|
||||
|
||||
foreach my $post (@{$newAsset->getPosts}) {
|
||||
$post->rethreadUnder($newAsset);
|
||||
}
|
||||
$newAsset->normalizeLastPost;
|
||||
|
||||
return $newAsset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub createSubscriptionGroup {
|
||||
my $self = shift;
|
||||
|
|
@ -592,6 +606,13 @@ sub setLastPost {
|
|||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
sub normalizeLastPost {
|
||||
my $self = shift;
|
||||
# Hmm. Is this right?
|
||||
my ($lastPostId, $lastPostDate) = $self->session->db->quickArray("SELECT a.assetId, a.creationDate FROM asset as a INNER JOIN Post as t ON a.assetId = t.assetId WHERE t.threadId = ? ORDER BY a.creationDate DESC LIMIT 1", [$self->getId]);
|
||||
$self->setLastPost($lastPostId, $lastPostDate);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue