fix [ 1267326 ] LastPost varibale not updating correctly in Msg Board
This commit is contained in:
parent
3d1a735050
commit
3360e4c979
4 changed files with 141 additions and 51 deletions
|
|
@ -726,30 +726,6 @@ sub rate {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( id, date )
|
||||
|
||||
Sets the last reply of this thread.
|
||||
|
||||
=head3 id
|
||||
|
||||
The assetId of the most recent post.
|
||||
|
||||
=head3 date
|
||||
|
||||
The date of the most recent post.
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update(lastPostId=>$id, lastPostDate=>$date);
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -853,7 +829,7 @@ sub trash {
|
|||
$self->getThread->decrementReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($threadLineage.'%')." and Post.assetId<>".quote($self->getId)." and asset.assetId=Post.assetId order by Post.dateSubmitted desc");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($threadLineage.'%')." and Post.assetId<>".quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getThread->setLastPost($id,$date);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,6 +465,31 @@ sub rate {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( id, date )
|
||||
|
||||
Sets the last reply of this thread.
|
||||
|
||||
=head3 id
|
||||
|
||||
The assetId of the most recent post.
|
||||
|
||||
=head3 date
|
||||
|
||||
The date of the most recent post.
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head setParent ( newParent )
|
||||
|
|
@ -542,7 +567,7 @@ sub trash {
|
|||
$self->getParent->decrementThreads;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($parentLineage.'%')." and Post.assetId<>".quote($self->getId)." and Post.assetId=asset.assetId order by Post.dateSubmitted desc");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($parentLineage.'%')." and Post.assetId<>".quote($self->getId)." and Post.assetId=asset.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getParent->setLastPost('','') ? $self->getParent->setLastPost($id,$date) : $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue