[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Bug Tracking System.
  #
  # The Initial Developer of the Original Code is Netscape Communications
  # Corporation. Portions created by Netscape are
  # Copyright (C) 1998 Netscape Communications Corporation. All
  # Rights Reserved.
  #
  # Contributor(s): Myk Melez <myk@mozilla.org>
  #%]

[%# INTERFACE:
  # bug_id: number; the ID of the bug that was changed/checked.
  #
  # type: string; the type of change/check that was made: "bug" when a bug
  #   is changed, "dupe" when a duplication notation is added to a bug,
  #   and "dep" when a bug is checked for changes to its dependencies.
  #
  # sent_bugmail: The results of Bugzilla::BugMail::Send().
  #
  # commentsilent: boolean; whether sending of the e-mails was suppressed.
  #%]

[% DEFAULT type="bug" %]

[% Link = BLOCK %][% "$terms.Bug $bug_id" FILTER bug_link(bug_id) %][% END %]
[% link = BLOCK %][% "$terms.bug $bug_id" FILTER bug_link(bug_id) %][% END %]

[%
  statuses = {
    '+' => "granted"
    '-' => "denied"
    'X' => "canceled"
    '?' => "requested"
  };
  titles = {
    'bug'     => "Changes submitted for $link",
    'dupe'    => "Duplicate notation added to $link",
    'dep'     => "Checking for dependency changes on $link",
    'votes'   => "$Link confirmed by number of votes",
    'created' => "$Link has been added to the database",
    'move'    => "$Link has been moved to another database",
    'flag'    => "Flag $new_flag.name " _ statuses.${new_flag.status},
    'votes-removed' => "Votes removed from $Link in accordance with new product settings",
  }
%]

<dl>
  <dt>[% titles.$type %]</dt>
  <dd>
    [% IF NOT commentsilent %]
      <dl>
      [% PROCESS emails
         description = "Email sent to"
         names = sent_bugmail.sent
      %]
      [% PROCESS emails
         description = "Excluding"
         names = sent_bugmail.excluded
      %]
      </dl>
    [% ELSE %]
      Your changes marked as Silent. No mail is sent.
    [% END %]
    [%# Links to more information about the changed bug. %]
    [% Hook.process("links") %]
  </dd>
</dl>

[%############################################################################%]
[%# Block for a set of email addresses                                       #%]
[%############################################################################%]

[% BLOCK emails %]
  <dt>[% description FILTER html %]:</dt>
  <dd>
  [% IF Bugzilla.user.can_see_bug(bug_id) %]
    [% IF names.size > 0 %]
      [%+ FOREACH name = names %]
        <code>[% name FILTER html %]</code>[% ", " UNLESS loop.last() %]
      [% END %]
    [% ELSE %]
      no one
    [% END %]
  [% ELSE %]
    (list of e-mails not available)
  [% END %]
  </dd>
[% END %]
