r1605: Comments posted by guests can now be deleted. Fixes bug://report/120
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 11 Feb 2008 20:02:26 +0000 (20:02 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 11 Feb 2008 20:02:26 +0000 (20:02 +0000)
* docs/changes.txt: Changelog update
* includes/api_comment.php: Remove the relation on the Comment.userid field
* editcomment.php: Because we removed the relation on Comment.userid, we need to manually get the user info

docs/changes.txt
editcomment.php
includes/api_comment.php

index 80bbe55a1170079ee75e7bc54cc8c46f7d46ce54..73632e4f80bfc158b6e7e7df6d0a7c07d746373d 100644 (file)
@@ -11,6 +11,7 @@
 - Fixed: If a user has set a language that does not exist anymore, then bug notifications would fail (bug://report/97)
 - Fixed: Users of UTF8 languages would experience problems after upgrading (if the $utf8 config directive as ON) because the installer wasn't running in UTF8
 - Fixed: In Authentication::_createBugdarUser there was a variable capitalization error (bug://report/106)
+- Fixed: Comments posted by guests could not be deleted (bug://report/120)
 
 1.2.1
 ===============================
index 1ec7c4ef3c8b7ee5e72a34671910a2ecf19ad135..a9ca64dbc35f1b9275b3130062c0d10fad257967 100644 (file)
@@ -189,7 +189,15 @@ if ($_REQUEST['do'] == 'edit')
        }
        
        $comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']);
-       $comment['postby'] = construct_user_display($commentapi->relations['userid']->objdata);
+       if ($comment['userid'])
+       {
+               $commenter = new UserAPI($bugsys);
+               $commenter->set('userid', $comment['userid']);
+               $commenter->set_condition();
+               $commenter->fetch();
+               $commenter = $commenter->objdata;
+       }
+       $comment['postby'] = construct_user_display($commenter);
        $comment['comment'] = $bugsys->sanitize($comment['comment']);
        $show['hide'] = ($bug['initialreport'] != $comment['commentid'] ? true : false);
        eval('$template->flush("' . $template->fetch('editcomment') . '");');
index 7a51a2ae8799da027ac6953f5953134c6416df96..b33f2f7814afa495a2ae79b399a9c96404754333 100644 (file)
@@ -40,7 +40,7 @@ class CommentAPI extends API
        var $fields = array(
                'commentid'                     => array(TYPE_UINT,     REQ_AUTO,       'verify_nozero'),
                'bugid'                         => array(TYPE_UINT,     REQ_YES,        'verify_nozero'),
-               'userid'                        => array(TYPE_UINT,     REQ_NO,         null,                           array('includes/api_user.php', 'UserAPI')),
+               'userid'                        => array(TYPE_UINT,     REQ_NO),
                'dateline'                      => array(TYPE_UINT,     REQ_SET),
                'parselinks'            => array(TYPE_BOOL,     REQ_NO),
                'comment'                       => array(TYPE_STR,      REQ_YES,        'verify_noempty'),