diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 4ad6c8aec..70cd08865 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -43,6 +43,7 @@ use Bugzilla::Product; use Bugzilla::Component; use Bugzilla::Status; use Bugzilla::Mailer; +use Bugzilla::Diff; use Date::Parse; use Date::Format; @@ -635,13 +636,13 @@ sub sendMail for my $change (@$diffs) { - my $field = Bugzilla->get_field($change->{'fieldname'}); - if (($change->{'fieldname'} eq 'longdesc' || $field->{'type'} eq FIELD_TYPE_TEXTAREA) && !$change->{'both'}) + my $field = Bugzilla->get_field($change->{fieldname}); + if (($change->{fieldname} eq 'longdesc' || $field->{type} eq FIELD_TYPE_TEXTAREA) && !$change->{lines}) { - my $diff = new Bugzilla::Diff($change->{'removed'}, $change->{'added'}); - $change->{'both'} = $diff->get_table; - $change->{'diff_removed'} = $diff->get_removed; - $change->{'diff_added'} = $diff->get_added; + my $diff = new Bugzilla::Diff($change->{removed}, $change->{added}); + $change->{lines} = $diff->get_table; + $change->{diff_removed} = $diff->get_removed; + $change->{diff_added} = $diff->get_added; } } diff --git a/Bugzilla/Diff.pm b/Bugzilla/Diff.pm index 0efdb771e..aebd524c2 100644 --- a/Bugzilla/Diff.pm +++ b/Bugzilla/Diff.pm @@ -67,7 +67,7 @@ sub get_hash { my ($self, $force) = @_; $force = 0 unless $force; - if ($force || !($self->{'context'})) + if ($force || !$self->{'context'}) { $self->{'diff'} = $self->diff($self->{old}, $self->{new}); $self->make_context; @@ -79,13 +79,13 @@ sub get_hash return $self->{'context'}; } -# templated diff +# formatted diff sub get_table { - my ($self, $force) = @_; + my ($self, $force, $column) = @_; $force = 0 unless $force; my $diff = $self->get_hash($force); - my $result = '
' . ($old->{'type'} eq TYPE_REM ? TYPE_REM : '') . ' | '; - $result .= '{'type'} eq TYPE_REM ? ' style="border: 1px solid #900;"' : '') . '>' . $oval . ' | '; - $result .= '' . ($new->{'type'} eq TYPE_ADD ? TYPE_ADD : '') . ' | '; - $result .= '{'type'} eq TYPE_ADD ? ' style="border: 1px solid #090;"' : '') . '>' . $nval . ' | '; - $result .= '' . + $oval . ' | ' . + $nval . ' | '; } - $result .= '
-[% IF severity == 'blocker' OR severity == 'critical' %]
- Bug [% bugid %] [[% severity | upper %]] - [% summary | html %]
-[% ELSE %]
-Bug [% bugid %] - [% summary | html %]
-[% END %]
-
(prod:[% product %].[% comp %], pri:[% priority %], sev:[% severity %], miles:[% targetmilestone %])
-
Comment #[% comment.count %] from - - - [% (comment.author.name || comment.author.login) FILTER html %] - - [% comment.bug_when FILTER time(undef, to_user.timezone) %]
-[% f.desc FILTER html %]: | [% f.value FILTER html %] |
---|
- Bug [% d.bug_id %] depends - on bug [% d.dep %], - which changed state. -Bug [% d.dep %] - summary: [% d.short_desc | html %]. - |
[% d.realname || d.login_name %] changed: | ||||
What | Removed | Added | ||
---|---|---|---|---|
- [% IF d.fieldname == 'longdesc' %] - - [% IF d.comment_count > 0 %]Comment #[% d.comment_count %][% ELSE %]Description[% END %] - - [% ELSE %] - [% d.fielddesc %] - [% END %] - | - [% IF d.both %][% d.both %] | [% ELSE %][% d.removed %] | [% d.added %] | [% END %] -
---
-Configure [% terms.bug %]mail
-------- You are receiving this mail because: -------
-[% FOREACH relationship = reasons %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-You are the assignee for the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-You reported the [% terms.bug %].
- [% CASE constants.REL_QA %]
-You are the QA contact for the [% terms.bug %].
- [% CASE constants.REL_CC %]
-You are on the CC list for the [% terms.bug %]. Remove yourself from the CC list.
- [% CASE constants.REL_VOTER %]
-You are a voter for the [% terms.bug %].
- [% CASE constants.REL_GLOBAL_WATCHER %]
-You are watching all [% terms.bug %] changes.
- [% END %]
-[% END %]
-[% FOREACH relationship = reasons_watch %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-
You are watching the assignee of the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-
You are watching the reporter.
- [% CASE constants.REL_QA %]
-
You are watching the QA contact of the [% terms.bug %].
- [% CASE constants.REL_CC %]
-
You are watching someone on the CC list of the [% terms.bug %].
- [% CASE constants.REL_VOTER %]
-
You are watching a voter for the [% terms.bug %].
- [% END %]
-[% END %]
-
-[% IF severity == 'blocker' OR severity == 'critical' %]
- Bug [% bugid %] [[% severity | upper %]] - [% summary | html %]
-[% ELSE %]
-Bug [% bugid %] - [% summary | html %]
-[% END %]
-
(prod:[% product %].[% comp %], pri:[% priority %], sev:[% severity %], miles:[% targetmilestone %])
-
Comment #[% comment.count %] from - - - [% (comment.author.name || comment.author.login) FILTER html %] - - [% comment.bug_when FILTER time(undef, to_user.timezone) %]
-[% f.desc FILTER html %]: | [% f.value FILTER html %] |
---|
- Bug [% d.bug_id %] depends - on bug [% d.dep %], - which changed state. -Bug [% d.dep %] - summary: [% d.short_desc | html %]. - |
[% d.realname || d.login_name %] changed: | ||||
What | Removed | Added | ||
---|---|---|---|---|
- [% IF d.fieldname == 'longdesc' %] - - [% IF d.comment_count > 0 %]Comment #[% d.comment_count %][% ELSE %]Description[% END %] - - [% ELSE %] - [% d.fielddesc %] - [% END %] - | - [% IF d.both %][% d.both %] | [% ELSE %][% d.removed %] | [% d.added %] | [% END %] -
---
-Configure [% terms.bug %]mail
-------- You are receiving this mail because: -------
-[% FOREACH relationship = reasons %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-You are the assignee for the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-You reported the [% terms.bug %].
- [% CASE constants.REL_QA %]
-You are the QA contact for the [% terms.bug %].
- [% CASE constants.REL_CC %]
-You are on the CC list for the [% terms.bug %]. Remove yourself from the CC list.
- [% CASE constants.REL_VOTER %]
-You are a voter for the [% terms.bug %].
- [% CASE constants.REL_GLOBAL_WATCHER %]
-You are watching all [% terms.bug %] changes.
- [% END %]
-[% END %]
-[% FOREACH relationship = reasons_watch %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-
You are watching the assignee of the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-
You are watching the reporter.
- [% CASE constants.REL_QA %]
-
You are watching the QA contact of the [% terms.bug %].
- [% CASE constants.REL_CC %]
-
You are watching someone on the CC list of the [% terms.bug %].
- [% CASE constants.REL_VOTER %]
-
You are watching a voter for the [% terms.bug %].
- [% END %]
-[% END %]
-
-[% IF severity == 'blocker' OR severity == 'critical' %]
- Bug [% bugid %] [[% severity | upper %]] - [% summary | html %]
-[% ELSE %]
-Bug [% bugid %] - [% summary | html %]
-[% END %]
-
(prod:[% product %].[% comp %], pri:[% priority %], sev:[% severity %], miles:[% targetmilestone %])
-
Comment #[% comment.count %] from - - - [% (comment.author.name || comment.author.login) FILTER html %] - - [% comment.bug_when FILTER time(undef, to_user.timezone) %]
-[% f.desc FILTER html %]: | [% f.value FILTER html %] |
---|
- Bug [% d.bug_id %] depends - on bug [% d.dep %], - which changed state. -Bug [% d.dep %] - summary: [% d.short_desc | html %]. - |
[% d.realname || d.login_name %] changed: | ||||
What | Removed | Added | ||
---|---|---|---|---|
- [% IF d.fieldname == 'longdesc' %] - - [% IF d.comment_count > 0 %]Comment #[% d.comment_count %][% ELSE %]Description[% END %] - - [% ELSE %] - [% d.fielddesc %] - [% END %] - | - [% IF d.both %][% d.both %] | [% ELSE %][% d.removed %] | [% d.added %] | [% END %] -
---
-Configure [% terms.bug %]mail
-------- You are receiving this mail because: -------
-[% FOREACH relationship = reasons %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-You are the assignee for the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-You reported the [% terms.bug %].
- [% CASE constants.REL_QA %]
-You are the QA contact for the [% terms.bug %].
- [% CASE constants.REL_CC %]
-You are on the CC list for the [% terms.bug %]. Remove yourself from the CC list.
- [% CASE constants.REL_VOTER %]
-You are a voter for the [% terms.bug %].
- [% CASE constants.REL_GLOBAL_WATCHER %]
-You are watching all [% terms.bug %] changes.
- [% END %]
-[% END %]
-[% FOREACH relationship = reasons_watch %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-
You are watching the assignee of the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-
You are watching the reporter.
- [% CASE constants.REL_QA %]
-
You are watching the QA contact of the [% terms.bug %].
- [% CASE constants.REL_CC %]
-
You are watching someone on the CC list of the [% terms.bug %].
- [% CASE constants.REL_VOTER %]
-
You are watching a voter for the [% terms.bug %].
- [% END %]
-[% END %]
-
-[% IF severity == 'blocker' OR severity == 'critical' %]
- Bug [% bugid %] [[% severity | upper %]] - [% summary | html %]
-[% ELSE %]
-Bug [% bugid %] - [% summary | html %]
-[% END %]
-
(prod:[% product %].[% comp %], pri:[% priority %], sev:[% severity %], miles:[% targetmilestone %])
-
Comment #[% comment.count %] from - - - [% (comment.author.name || comment.author.login) FILTER html %] - - [% comment.bug_when FILTER time(undef, to_user.timezone) %]
-[% f.desc FILTER html %]: | [% f.value FILTER html %] |
---|
- Bug [% d.bug_id %] depends - on bug [% d.dep %], - which changed state. -Bug [% d.dep %] - summary: [% d.short_desc | html %]. - |
[% d.realname || d.login_name %] changed: | ||||
What | Removed | Added | ||
---|---|---|---|---|
- [% IF d.fieldname == 'longdesc' %] - - [% IF d.comment_count > 0 %]Comment #[% d.comment_count %][% ELSE %]Description[% END %] - - [% ELSE %] - [% d.fielddesc %] - [% END %] - | - [% IF d.both %][% d.both %] | [% ELSE %][% d.removed %] | [% d.added %] | [% END %] -
---
-Configure [% terms.bug %]mail
-------- You are receiving this mail because: -------
-[% FOREACH relationship = reasons %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-You are the assignee for the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-You reported the [% terms.bug %].
- [% CASE constants.REL_QA %]
-You are the QA contact for the [% terms.bug %].
- [% CASE constants.REL_CC %]
-You are on the CC list for the [% terms.bug %]. Remove yourself from the CC list.
- [% CASE constants.REL_VOTER %]
-You are a voter for the [% terms.bug %].
- [% CASE constants.REL_GLOBAL_WATCHER %]
-You are watching all [% terms.bug %] changes.
- [% END %]
-[% END %]
-[% FOREACH relationship = reasons_watch %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-
You are watching the assignee of the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-
You are watching the reporter.
- [% CASE constants.REL_QA %]
-
You are watching the QA contact of the [% terms.bug %].
- [% CASE constants.REL_CC %]
-
You are watching someone on the CC list of the [% terms.bug %].
- [% CASE constants.REL_VOTER %]
-
You are watching a voter for the [% terms.bug %].
- [% END %]
-[% END %]
-
-[% IF severity == 'blocker' OR severity == 'critical' %]
- Bug [% bugid %] [[% severity | upper %]] - [% summary | html %]
-[% ELSE %]
-Bug [% bugid %] - [% summary | html %]
-[% END %]
-
(prod:[% product %].[% comp %], pri:[% priority %], sev:[% severity %], miles:[% targetmilestone %])
-
Comment #[% comment.count %] from - - - [% (comment.author.name || comment.author.login) FILTER html %] - - [% comment.bug_when FILTER time(undef, to_user.timezone) %]
-[% f.desc FILTER html %]: | [% f.value FILTER html %] |
---|
- Bug [% d.bug_id %] depends - on bug [% d.dep %], - which changed state. -Bug [% d.dep %] - summary: [% d.short_desc | html %]. - |
[% d.realname || d.login_name %] changed: | ||||
What | Removed | Added | ||
---|---|---|---|---|
- [% IF d.fieldname == 'longdesc' %] - - [% IF d.comment_count > 0 %]Comment #[% d.comment_count %][% ELSE %]Description[% END %] - - [% ELSE %] - [% d.fielddesc %] - [% END %] - | - [% IF d.both %][% d.both %] | [% ELSE %][% d.removed %] | [% d.added %] | [% END %] -
---
-Configure [% terms.bug %]mail
-------- You are receiving this mail because: -------
-[% FOREACH relationship = reasons %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-You are the assignee for the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-You reported the [% terms.bug %].
- [% CASE constants.REL_QA %]
-You are the QA contact for the [% terms.bug %].
- [% CASE constants.REL_CC %]
-You are on the CC list for the [% terms.bug %]. Remove yourself from the CC list.
- [% CASE constants.REL_VOTER %]
-You are a voter for the [% terms.bug %].
- [% CASE constants.REL_GLOBAL_WATCHER %]
-You are watching all [% terms.bug %] changes.
- [% END %]
-[% END %]
-[% FOREACH relationship = reasons_watch %]
- [% SWITCH relationship %]
- [% CASE constants.REL_ASSIGNEE %]
-
You are watching the assignee of the [% terms.bug %].
- [% CASE constants.REL_REPORTER %]
-
You are watching the reporter.
- [% CASE constants.REL_QA %]
-
You are watching the QA contact of the [% terms.bug %].
- [% CASE constants.REL_CC %]
-
You are watching someone on the CC list of the [% terms.bug %].
- [% CASE constants.REL_VOTER %]
-
You are watching a voter for the [% terms.bug %].
- [% END %]
-[% END %]
-