From 280323d0a6663eab83e41075b7ce42bb10ab4413 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 11 Feb 2008 20:02:26 +0000 Subject: [PATCH] r1605: Comments posted by guests can now be deleted. Fixes bug://report/120 * 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 | 1 + editcomment.php | 10 +++++++++- includes/api_comment.php | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 80bbe55..73632e4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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 =============================== diff --git a/editcomment.php b/editcomment.php index 1ec7c4e..a9ca64d 100644 --- a/editcomment.php +++ b/editcomment.php @@ -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') . '");'); diff --git a/includes/api_comment.php b/includes/api_comment.php index 7a51a2a..b33f2f7 100644 --- a/includes/api_comment.php +++ b/includes/api_comment.php @@ -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'), -- 2.43.5