Skip to content

Instantly share code, notes, and snippets.

@weitzman
Created October 11, 2011 02:24
Show Gist options
  • Save weitzman/1277120 to your computer and use it in GitHub Desktop.
Save weitzman/1277120 to your computer and use it in GitHub Desktop.
diff --git a/includes/mail.inc b/includes/mail.inc
index 83be066..986fb42 100644
--- a/includes/mail.inc
+++ b/includes/mail.inc
@@ -560,13 +560,18 @@ function project_issue_mail_generate_followup_mail_body($node, $history, $displa
'label' => $fields['updator'],
);
- $summary = theme('project_issue_mail_summary', $entry, $node, $comment_changes, $display_files);
+ // Append the metadata which has changed.
+ $summary = theme('project_issue_mail_summary', $entry, $node, $comment_changes, $display_files, FALSE);
// Create main body content
project_issue_mail_output($content, 1, $entry->format);
$body = "$content\n$entry->name\n";
- // Append complete follow-up history if recient prefers that.
+ // Append all current metadata
+ $current = project_issue_metadata_changes($node, $new_data, $new_data);
+ $summary = theme('project_issue_mail_summary', $entry, $node, $current, $display_files, TRUE);
+
+ // Append complete follow-up history if recipient prefers that.
if ($mail_body == PROJECT_ISSUE_MAIL_BODY_FULL_HISTORY) {
$hr = str_repeat('-', 72);
@@ -606,10 +611,12 @@ function project_issue_mail_generate_followup_mail_body($node, $history, $displa
* is the output of the project_issue_metadata_changes() function.
* @param $display_files
* Boolean indicating if file attachments should be displayed.
+ * @param $show_unchanged
+ * Display metadata properties which did not change.
* @return
* A string containing the themed text of the issue metadata table.
*/
-function theme_project_issue_mail_summary($entry, $node, $changes, $display_files) {
+function theme_project_issue_mail_summary($entry, $node, $changes, $display_files, $show_unchanged = TRUE) {
// Mail summary (status values).
$summary = '';
foreach ($changes as $field => $change) {
@@ -630,10 +637,12 @@ function theme_project_issue_mail_summary($entry, $node, $changes, $display_file
* @param $change
* A nested array containing changes to project issue metadata
* for the given issue or comment.
+ * @param $show_unchanged
+ * Display properties which did not change.
* @return
* A themed line or lines of text ready for inclusion into the email body.
*/
-function theme_project_issue_mail_summary_field($node, $field_name, $change) {
+function theme_project_issue_mail_summary_field($node, $field_name, $change, $show_unchanged = TRUE) {
// We need to run the label name through strip_tags here so that
// the spacing isn't messed up if there are HTML tags in $change['label'].
$text = str_pad(strip_tags($change['label']). ':', 14);
@@ -684,7 +693,7 @@ function theme_project_issue_mail_summary_field($node, $field_name, $change) {
// For example, the project, category, etc. are printed in each email
// whether or not they have changed.
// @TODO: Should we really assume the field in is $node->project_issue[]?
- if (isset($node->project_issue[$field_name])) {
+ if ($show_unchanged && isset($node->project_issue[$field_name])) {
$summary_row .= " $text". project_issue_change_summary($field_name, $node->project_issue[$field_name]) ."\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment