appdb/ ./deletecomment.php include/comment.php ...
WineHQ
wineowner at wine.codeweavers.com
Thu Aug 23 21:52:34 CDT 2007
ChangeSet ID: 31340
CVSROOT: /opt/cvs-commit
Module name: appdb
Changes by: wineowner at winehq.org 2007/08/23 21:52:34
Modified files:
. : deletecomment.php
include : comment.php version.php
Log message:
Chris Morgan <cmorgan at alum.wpi.edu>
Fix comment::delete() to take $bSilent as an input parameter and use
comment::SendNotificationEmail(). Update version::delete() to pass false into comment::delete()
so we don't send an email for each comment we are deleting for a given version. Fixes bug 8473.
Patch: http://cvs.winehq.org/patch.py?id=31340
Old revision New revision Changes Path
1.32 1.33 +3 -3 appdb/deletecomment.php
1.38 1.39 +49 -22 appdb/include/comment.php
1.146 1.147 +4 -3 appdb/include/version.php
Index: appdb/deletecomment.php
diff -u -p appdb/deletecomment.php:1.32 appdb/deletecomment.php:1.33
--- appdb/deletecomment.php:1.32 24 Aug 2007 2:52:34 -0000
+++ appdb/deletecomment.php 24 Aug 2007 2:52:34 -0000
@@ -6,7 +6,7 @@
* - iCommentId, comment identifier
*
* Optional parameters:
- * - sWhy, reason for deleting the comment
+ * - sReplyText, reason for deleting the comment
* - iDeleteIt, 1 if the deletion has been confirmed
*/
@@ -40,7 +40,7 @@ if($_SESSION['current']->getPref("confir
echo htmlify_urls($oComment->sBody), "<br /><br />\n";
echo html_frame_end();
echo '<table width="100%" border=0 cellpadding=0 cellspacing=1>',"\n";
- echo "<tr class=color1><td colspan=2><textarea name=\"sWhy\" cols=\"70\" rows=\"15\" wrap=\"virtual\"></textarea></td></tr>\n";
+ echo "<tr class=color1><td colspan=2><textarea name=\"sReplyText\" cols=\"70\" rows=\"15\" wrap=\"virtual\"></textarea></td></tr>\n";
echo "<tr class=color1><td colspan=2 align=center>\n";
echo " <input type=\"submit\" value=\"Delete Comment\" class=\"button\" />\n";
echo "</td></tr>\n";
@@ -54,7 +54,7 @@ if($_SESSION['current']->getPref("confir
// otherwise, just delete the comment
} else
{
- $oComment->delete($aClean['sWhy']);
+ $oComment->delete(true);
$oVersion = new version($oComment->iVersionId);
util_redirect_and_exit($oVersion->objectMakeUrl());
}
Index: appdb/include/comment.php
diff -u -p appdb/include/comment.php:1.38 appdb/include/comment.php:1.39
--- appdb/include/comment.php:1.38 24 Aug 2007 2:52:34 -0000
+++ appdb/include/comment.php 24 Aug 2007 2:52:34 -0000
@@ -162,7 +162,7 @@ class Comment {
* Informs interested people about the deletion.
* Returns true on success and false on failure.
*/
- function delete($sReason=null)
+ function delete($bSilent = false)
{
$hResult = query_parameters("DELETE FROM appComments WHERE commentId = '?'", $this->iCommentId);
if ($hResult)
@@ -170,33 +170,60 @@ class Comment {
/* fixup the child comments so the parentId points to a valid parent comment */
$hResult = query_parameters("UPDATE appComments set parentId = '?' WHERE parentId = '?'",
$this->iParentId, $this->iCommentId);
- $sEmail = User::get_notify_email_address_list($this->iAppId, $this->iVersionId);
- $sEmail .= $this->oOwner->sEmail;
- if($sEmail)
+
+ if(!$bSilent)
{
- $sSubject = "Comment for '".version::fullName($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
- $oVersion = new version($this->iVersionId);
- $sMsg = $oVersion->objectMakeUrl()."\n";
- $sMsg .= "\n";
- $sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
- $sMsg .= "\n";
- $sMsg .= "Subject: ".$this->sSubject."\r\n";
- $sMsg .= "\n";
- $sMsg .= $this->sBody."\r\n";
- $sMsg .= "\n";
- $sMsg .= "Because:\n";
- if($sReason)
- $sMsg .= $sReason."\n";
- else
- $sMsg .= "No reason given.\n";
- mail_appdb($sEmail, $sSubject ,$sMsg);
- }
- addmsg("Comment deleted.", "green");
+ $this->SendNotificationMail("delete");
+ }
+
return true;
+ } else
+ {
+ addmsg("Error removing the deleted comment!", "red");
}
+
return false;
}
+ function SendNotificationMail($sAction="add", $sMsg = null)
+ {
+ global $aClean;
+
+ // use 'sReplyText' if it is defined, otherwise define the value as an empty string
+ if(!isset($aClean['sReplyText']))
+ $aClean['sReplyText'] = "";
+
+ $oApp = new Application($this->iAppId);
+ switch($sAction)
+ {
+ case "delete":
+ $sSubject = "Comment for '".version::fullName($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
+ $oVersion = new version($this->iVersionId);
+ $sMsg = $oVersion->objectMakeUrl()."\n";
+ $sMsg .= "\n";
+ $sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
+ $sMsg .= "\n";
+ $sMsg .= "Subject: ".$this->sSubject."\r\n";
+ $sMsg .= "\n";
+ $sMsg .= $this->sBody."\r\n";
+ $sMsg .= "\n";
+ $sMsg .= "Because:\n";
+ if($sReason)
+ $sMsg .= $sReason."\n";
+ else
+ $sMsg .= "No reason given.\n";
+
+ addmsg("Comment deleted.", "green");
+
+ break;
+ }
+
+ $sEmail = User::get_notify_email_address_list($this->iAppId, $this->iVersionId);
+ $sEmail .= $this->oOwner->sEmail;
+ if($sEmail)
+ mail_appdb($sEmail, $sSubject, $sMsg);
+ }
+
function get_comment_count_for_versionid($iVersionId)
{
$sQuery = "SELECT count(*) as cnt from appComments where versionId = '?'";
Index: appdb/include/version.php
diff -u -p appdb/include/version.php:1.146 appdb/include/version.php:1.147
--- appdb/include/version.php:1.146 24 Aug 2007 2:52:34 -0000
+++ appdb/include/version.php 24 Aug 2007 2:52:34 -0000
@@ -256,7 +256,10 @@ class version {
foreach($aCommentsIds as $iCommentId)
{
$oComment = new Comment($iCommentId);
- $oComment->delete($bSilent);
+
+ // delete the comment silently, we don't want to send out
+ // any notifications since the version is being deleted
+ $oComment->delete(false);
}
@@ -297,8 +300,6 @@ class version {
}
-
-
/* fetch Test Results Ids */
$aTestingIds = array();
$sQuery = "SELECT *
More information about the wine-cvs
mailing list