From bc466ab74f990295638cd04e51f8ce1138e577cf Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 18 Mar 2010 12:40:47 -0700 Subject: [PATCH] Add a validParent check to Post. --- lib/WebGUI/Asset/Post.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index a98cd8500..5fc55ca54 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -1348,6 +1348,22 @@ sub prepareView { #------------------------------------------------------------------- +=head2 validParent + +Make sure that the current session asset is a Thread or Post for pasting and adding checks. + +This is a class method. + +=cut + +sub validParent { + my $class = shift; + my $session = shift; + return $session->asset->isa('WebGUI::Asset::Post'); +} + +#------------------------------------------------------------------- + =head2 view Increment the number of views for this Post, and then display the Thread containing