Changes to Post and Collaboration, for new Asset instanciators.
This commit is contained in:
parent
f88c18ee50
commit
3d52c45655
2 changed files with 7 additions and 7 deletions
|
|
@ -296,7 +296,7 @@ END_SQL
|
|||
[$self->parentId, $self->getId, $sortCompareValue, $tagId, $session->user->userId]
|
||||
);
|
||||
if ($id) {
|
||||
return WebGUI::Asset->new($session, $id, $class, $version);
|
||||
return WebGUI::Asset->newById($session, $id, $version);
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
|
@ -340,7 +340,7 @@ sub getLastPost {
|
|||
my $lastPostId = $self->lastPostId;
|
||||
my $lastPost;
|
||||
if ($lastPostId) {
|
||||
$lastPost = WebGUI::Asset::Post->new($self->session, $lastPostId);
|
||||
$lastPost = WebGUI::Asset::Post->newById($self->session, $lastPostId);
|
||||
}
|
||||
return $lastPost if (defined $lastPost);
|
||||
return $self;
|
||||
|
|
@ -644,7 +644,7 @@ See WebGUI::Asset::prepareView() for details.
|
|||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
my $template = WebGUI::Asset::Template->new($self->session, $self->getParent->threadTemplateId);
|
||||
my $template = WebGUI::Asset::Template->newByid($self->session, $self->getParent->threadTemplateId);
|
||||
$template->prepare($self->getMetaDataAsTemplateVariables);
|
||||
$self->{_viewTemplate} = $template;
|
||||
}
|
||||
|
|
@ -1085,7 +1085,7 @@ sub view {
|
|||
$p->setDataByQuery($sql, undef, undef, undef, "url", $currentPageUrl);
|
||||
foreach my $dataSet (@{$p->getPageData()}) {
|
||||
next unless ($dataSet->{className} eq "WebGUI::Asset::Post" || $dataSet->{className} eq "WebGUI::Asset::Post::Thread"); #handle non posts!
|
||||
my $reply = WebGUI::Asset::Post->new($self->session, $dataSet->{assetId}, $dataSet->{className}, $dataSet->{revisionDate});
|
||||
my $reply = WebGUI::Asset::Post->newById($self->session, $dataSet->{assetId}, $dataSet->{revisionDate});
|
||||
$reply->{'_thread' } = $self; # caching thread for better performance
|
||||
my %replyVars = %{$reply->getTemplateVars};
|
||||
$replyVars{isCurrent } = ($reply->getId eq $currentPost->getId);
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ sub appendPostListTemplateVars {
|
|||
my $i = 0;
|
||||
my ($icon, $datetime) = $self->session->quick(qw(icon datetime));
|
||||
foreach my $row (@$page) {
|
||||
my $post = WebGUI::Asset->new($self->session,$row->{assetId}, $row->{className}, $row->{revisionDate});
|
||||
my $post = WebGUI::Asset->newById($self->session,$row->{assetId}, $row->{revisionDate});
|
||||
$post->{_parent} = $self; # caching parent for efficiency
|
||||
my $controls = $icon->delete('func=delete',$post->url,"Delete") . $icon->edit('func=edit',$post->url);
|
||||
if ($self->sortBy eq "lineage") {
|
||||
|
|
@ -1017,7 +1017,7 @@ SQL
|
|||
my @posts;
|
||||
my $rssLimit = $self->itemsPerFeed;
|
||||
for my $postId (@postIds) {
|
||||
my $post = WebGUI::Asset->new($self->session, $postId, 'WebGUI::Asset::Post::Thread');
|
||||
my $post = WebGUI::Asset->newById($self->session, $postId);
|
||||
my $postUrl = $siteUrl . $post->getUrl;
|
||||
# Buggo: this is an abuse of 'author'. 'author' is supposed to be an email address.
|
||||
# But this is how it was in the original Collaboration RSS, so.
|
||||
|
|
@ -1342,7 +1342,7 @@ See WebGUI::Asset::prepareView() for details.
|
|||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->next::method;
|
||||
my $template = WebGUI::Asset::Template->new($self->session, $self->collaborationTemplateId);
|
||||
my $template = WebGUI::Asset::Template->newById($self->session, $self->collaborationTemplateId);
|
||||
if (!$template) {
|
||||
WebGUI::Error::ObjectNotFound::Template->throw(
|
||||
error => qq{Template not found},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue