From 65235990a3c7de8849ff8cfe49bcfe1a94ac7f09 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 2 Jul 2007 22:25:41 +0000 Subject: [PATCH] fix: Collaboration System can now be subclassed and still work with existing Thread and Post assets --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset/Post.pm | 4 ++-- lib/WebGUI/Asset/Post/Thread.pm | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index b63b313f2..ebc0f3d82 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -48,6 +48,8 @@ http://www.webgui.org/bugs/tracker/user-profile-images-disappear-after-updat - RFE: HttpProxy - regexp for URLs that will not be proxied. Url pattern filters can now be created in HttpProxy wobject properties. + - Collaboration System wobjects can now be subclassed and still work with the + existing Thread and Post assets. 7.3.20 - fix: Deactivated Users Subscriptions (perlDreamer Consulting, LLC) diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index d155ec544..061a0665f 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -71,7 +71,7 @@ sub addRevision { my $threadId = $newSelf->get("threadId"); my $now = time(); if ($threadId eq "") { # new post - if ($newSelf->getParent->get("className") eq "WebGUI::Asset::Wobject::Collaboration") { + if ($newSelf->getParent->isa("WebGUI::Asset::Wobject::Collaboration")) { $newSelf->update({threadId=>$newSelf->getId, dateSubmitted=>$now}); } else { $newSelf->update({threadId=>$newSelf->getParent->get("threadId"), dateSubmitted=>$now}); @@ -566,7 +566,7 @@ sub getThread { unless (defined $self->{_thread}) { my $threadId = $self->get("threadId"); if ($threadId eq "") { # new post - if ($self->getParent->get("className") eq "WebGUI::Asset::Wobject::Collaboration") { + if ($self->getParent->isa("WebGUI::Asset::Wobject::Collaboration")) { $threadId=$self->getId; } else { $threadId=$self->getParent->get("threadId"); diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index d4436b5ce..3a3f84fb8 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -631,7 +631,7 @@ An asset object to make the parent of this asset. sub setParent { my $self = shift; my $newParent = shift; - return 0 unless ($newParent->get("className") eq "WebGUI::Asset::Wobject::Collaboration"); + return 0 unless ($newParent->isa("WebGUI::Asset::Wobject::Collaboration")); # specify the Asset package here directly because we don't want to use the ruls in WebGUI::Asset::Post, as they don't fit for Threads. return $self->WebGUI::Asset::setParent($newParent); }