[pLog-svn] r4304 - plog/branches/lifetype-1.1.3/class/dao
Jon Daley
plogworld at jon.limedaley.com
Thu Nov 16 13:16:16 GMT 2006
You actually need enough spam comments to fill up more than one
page, since the Pager is the one who notices that the object isn't a
number.
On Thu, 16 Nov 2006, Jon Daley wrote:
> Steps to reproduce:
>
> Have a spam comment on a post.
> Go to the post, click on the CM (1) column.
> See the spam comment.
> Filter by "spam", instead of all comments.
> See lifetype die.
> Apply my changes.
> See lifetype work correctly.
>
> I think no one had ever viewed just spam on individual posts before.
> It works if you are looking for all spam in all posts, which is all I had
> ever done before.
>
>
> On Thu, 16 Nov 2006, Jon Daley wrote:
>
>> I don't really seem to be getting how to go about testing stuff. It
>> seems like a simple test would be to check the return type of the function.
>> It should always be an "int", right? and not an array of comments?
>>
>> On Thu, 16 Nov 2006, Oscar Renalias wrote:
>>> We'll have to verify this with a test case. It can't be that this
>>> method has been broken for so long, as it's used in a few places
>>> throughout the code.
>>>
>>> On 11/16/06, jondaley at devel.lifetype.net <jondaley at devel.lifetype.net>
>>> wrote:
>>>> Author: jondaley
>>>> Date: 2006-11-16 03:47:57 +0000 (Thu, 16 Nov 2006)
>>>> New Revision: 4304
>>>>
>>>> Modified:
>>>> plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php
>>>> Log:
>>>> this can't be doing what it was supposed to be doing, can it? if the
>>>> status was COMMENT_STATUS_SPAM, getNumComments used to return all of the
>>>> comment data?!
>>>>
>>>> Modified: plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php
>>>> ===================================================================
>>>> --- plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php
>>>> 2006-11-16 02:00:54 UTC (rev 4303)
>>>> +++ plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php
>>>> 2006-11-16 03:47:57 UTC (rev 4304)
>>>> @@ -179,28 +179,39 @@
>>>> $numComments = 0;
>>>> $articles = new Articles();
>>>> $article = $articles->getArticle( $artId );
>>>> -
>>>> +
>>>> + if(!$article)
>>>> + return 0;
>>>> +
>>>> if( $type == COMMENT_TYPE_COMMENT ) {
>>>> - if( $status == COMMENT_STATUS_ALL &&
>>>> $article ) {
>>>> + if( $status == COMMENT_STATUS_ALL ) {
>>>> $numComments =
>>>> $article->getTotalComments();
>>>> }
>>>> - elseif( $status == COMMENT_STATUS_NONSPAM
>>>> && $article ) {
>>>> + elseif( $status == COMMENT_STATUS_NONSPAM
>>>> ) {
>>>> $numComments =
>>>> $article->getNumComments();
>>>> }
>>>> + elseif( $status == COMMENT_STATUS_SPAM )
>>>> {
>>>> + $numComments =
>>>> $article->getTotalComments() - $article->getNumComments();
>>>> + }
>>>> else {
>>>> - $numComments =
>>>> $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status,
>>>> $type );
>>>> +// $numComments =
>>>> $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status,
>>>> $type );
>>>> + $numComments = 0;
>>>> }
>>>> }
>>>> else {
>>>> - if( $status == COMMENT_STATUS_ALL &&
>>>> $article ) {
>>>> + if( $status == COMMENT_STATUS_ALL ) {
>>>> $numComments =
>>>> $article->getTotalTrackBacks();
>>>> }
>>>> - elseif( $status == COMMENT_STATUS_NONSPAM
>>>> && $article ) {
>>>> + elseif( $status == COMMENT_STATUS_NONSPAM
>>>> ) {
>>>> $numComments =
>>>> $article->getNumTrackBacks();
>>>> }
>>>> + elseif( $status == COMMENT_STATUS_SPAM )
>>>> {
>>>> + $numComments =
>>>> $article->getTotalTrackbacks() - $article->getNumTrackbacks();
>>>> + }
>>>> else {
>>>> - $numComments =
>>>> $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status,
>>>> $type );
>>>> - }
>>>> +// $numComments =
>>>> $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status,
>>>> $type );
>>>> + $numComments = 0;
>>>> + }
>>>> }
>>>>
>>>> return( $numComments );
>>>>
>>>> _______________________________________________
>>>> pLog-svn mailing list
>>>> pLog-svn at devel.lifetype.net
>>>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>>>
>>
>> --
>> Jon Daley
>> http://jon.limedaley.com/
>>
>> Proofreading is more effective after publication.
>> -- Barker
>>
>
> --
> Jon Daley
> http://jon.limedaley.com/
>
> Nobody realizes that some people expend
> tremendous energy merely to be normal.
> -- Albert Camus
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
--
Jon Daley
http://jon.limedaley.com/
You can tell a lot about a fellow's character by his way of eating jellybeans.
-- Ronald Reagan
More information about the pLog-svn
mailing list