- fix: Username blank when editing user Visitor
- fix: Thread Count is off in the Collaboration system - Fixed an indexing problem with Product assets. - fix: Reply count off when restoring from trash - fix: Karma not spent properly - fix: Avatar Message Board Template Not Working
This commit is contained in:
parent
9384702260
commit
b7957742bc
11 changed files with 168 additions and 69 deletions
|
|
@ -714,6 +714,13 @@ sub postProcess {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub publish {
|
||||
my $self = shift;
|
||||
$self->getThread->sumReplies;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = $self->session->db->read("select storageId from Post where assetId=".$self->session->db->quote($self->getId));
|
||||
|
|
@ -772,6 +779,11 @@ sub rate {
|
|||
my ($sum) = $self->session->db->quickArray("select sum(rating) from Post_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->update({rating=>$sum});
|
||||
$self->getThread->rate($rating);
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
$self->session->user->karma(-$self->getThread->getParent->get("karmaSpentToRate"), "Rated Post ".$self->getId, "Rated a CS Post.");
|
||||
my $u = WebGUI::User->new($self->session, $self->get("ownerUserId"));
|
||||
$u->karma($self->getThread->getParent->get("karmaRatingMultiplier"), "Post ".$self->getId." Rated by ".$self->session->user->userId, "Had post rated.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -847,14 +859,14 @@ sub setStatusUnarchived {
|
|||
|
||||
=head2 trash
|
||||
|
||||
Moves post to the trash and decrements reply counter on thread.
|
||||
Moves post to the trash and updates reply counter on thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getThread->decrementReplies if ($self->isReply);
|
||||
$self->getThread->sumReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($threadLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
|
|
|
|||
|
|
@ -77,20 +77,6 @@ sub createSubscriptionGroup {
|
|||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 decrementReplies ( )
|
||||
|
||||
Deccrements this reply counter.
|
||||
|
||||
=cut
|
||||
|
||||
sub decrementReplies {
|
||||
my $self = shift;
|
||||
$self->update({replies=>$self->get("replies")-1});
|
||||
$self->getParent->decrementReplies;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
|
|
@ -426,7 +412,7 @@ The id of the reply that caused the replies counter to be incremented.
|
|||
|
||||
sub incrementReplies {
|
||||
my ($self, $dateOfReply, $replyId) = @_;
|
||||
$self->update({replies=>$self->get("replies")+1, lastPostId=>$replyId, lastPostDate=>$dateOfReply});
|
||||
$self->update({replies=>$self->getDescendantCount, lastPostId=>$replyId, lastPostDate=>$dateOfReply});
|
||||
$self->getParent->incrementReplies($dateOfReply,$replyId);
|
||||
}
|
||||
|
||||
|
|
@ -659,16 +645,30 @@ sub subscribe {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 sumReplies ( )
|
||||
|
||||
Calculates the number of replies to this thread and updates the counter to reflect that. Also triggers a count in the collaboration system.
|
||||
|
||||
=cut
|
||||
|
||||
sub sumReplies {
|
||||
my $self = shift;
|
||||
$self->update({replies=>$self->getDescendantCount});
|
||||
$self->getParent->sumReplies;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash
|
||||
|
||||
Moves thread to the trash and decrements reply counter on thread.
|
||||
Moves thread to the trash and updates reply counter on thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getParent->decrementThreads;
|
||||
$self->getParent->sumReplies;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($parentLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and Post.assetId=asset.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
|
|
|
|||
|
|
@ -262,34 +262,6 @@ sub createSubscriptionGroup {
|
|||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 decrementReplies ( )
|
||||
|
||||
Deccrements this reply counter.
|
||||
|
||||
=cut
|
||||
|
||||
sub decrementReplies {
|
||||
my $self = shift;
|
||||
$self->update({replies=>$self->get("replies")-1});
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 decrementThreads ( )
|
||||
|
||||
Deccrements this thread counter.
|
||||
|
||||
=cut
|
||||
|
||||
sub decrementThreads {
|
||||
my $self = shift;
|
||||
$self->update({threads=>$self->get("threads")-1});
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
|
|
@ -892,7 +864,9 @@ The unique identifier of the post being added.
|
|||
|
||||
sub incrementReplies {
|
||||
my ($self, $lastPostDate, $lastPostId) = @_;
|
||||
$self->update({replies=>$self->get("replies")+1, lastPostId=>$lastPostId, lastPostDate=>$lastPostDate});
|
||||
my $threads = $self->getChildCount;
|
||||
my $replies = $self->getDescendantCount - $threads;
|
||||
$self->update({replies=>$replies, threads=>$threads, lastPostId=>$lastPostId, lastPostDate=>$lastPostDate});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -913,7 +887,7 @@ The unique identifier of the post that was just added.
|
|||
|
||||
sub incrementThreads {
|
||||
my ($self, $lastPostDate, $lastPostId) = @_;
|
||||
$self->update({threads=>$self->get("threads")+1, lastPostId=>$lastPostId, lastPostDate=>$lastPostDate});
|
||||
$self->update({threads=>$self->getChildCount, lastPostId=>$lastPostId, lastPostDate=>$lastPostDate});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1051,6 +1025,34 @@ sub setLastPost {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 sumReplies ( )
|
||||
|
||||
Calculates the number of replies to this collaboration system and updates the counter to reflect that. Also updates thread count since it needs to know that to calculate reply count.
|
||||
|
||||
=cut
|
||||
|
||||
sub sumReplies {
|
||||
my $self = shift;
|
||||
my $threads = $self->getChildCount;
|
||||
my $replies = $self->getDescendantCount - $threads;
|
||||
$self->update({replies=>$replies, threads=>$threads});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 sumThreads ( )
|
||||
|
||||
Calculates the number of threads in this collaboration system and updates the counter to reflect that.
|
||||
|
||||
=cut
|
||||
|
||||
sub sumThreads {
|
||||
my $self = shift;
|
||||
$self->update({threads=>$self->getChildCount});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 subscribe ( )
|
||||
|
||||
Subscribes a user to this collaboration system.
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ sub indexContent {
|
|||
$indexer->addKeywords(join(" ", @data));
|
||||
@data = $self->session->db->buildArray("select benefit from Product_benefit where assetId=".$self->session->db->quote($self->getId));
|
||||
$indexer->addKeywords(join(" ", @data));
|
||||
@data = $self->session->db->buildArray("select concat(name,' ',value,' ', units') from Product_specification where assetId=".$self->session->db->quote($self->getId));
|
||||
@data = $self->session->db->buildArray("select concat(name,' ',value,' ', units) from Product_specification where assetId=".$self->session->db->quote($self->getId));
|
||||
$indexer->addKeywords(join(" ", @data));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue