summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl
blob: 881ed927f8000aa273b7728e27a00ff4f40ea9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[%
  FOREACH change_set IN bug.activity_stream;
    '<div class="change-set" id="' _ change_set.id _ '">';

    extra_class = "";
    IF change_set.user_id == bug.assigned_to.id;
      extra_class = "assignee";
    ELSIF change_set.user_id == bug.reporter.id;
      extra_class = "reporter";
    END;

    IF change_set.comment;
      PROCESS comment_header comment=change_set.comment;
    ELSE;
      PROCESS activity_header activities=change_set.activity id=change_set.id;
    END;

    IF change_set.comment;
      PROCESS comment_body comment=change_set.comment;
    END;
    FOREACH activity IN change_set.activity;
      PROCESS activity_body activity=activity;
    END;

    '</div>';
  END;
%]

[% BLOCK comment_header %]
  <div class="comment">
    [%# normal comment header %]
    <table class="layout-table change-head [% extra_class FILTER none %]" id="ch-[% comment.count FILTER none %]"
      [% IF comment.collapsed +%] style="display:none"[% END %]>
      <tr>
        <td rowspan="2" class="change-gravatar">
          [% INCLUDE bug_modal/user.html.tmpl
              u = comment.author
              gravatar_size = 32
              gravatar_only = 1
          %]
        </td>
        <td class="change-author">
          [% INCLUDE bug_modal/user.html.tmpl
              u = comment.author
          %]
          [% IF extra_class %]
            <span class="user-role">([% extra_class.ucfirst FILTER none %])</span>
          [% END %]
          [% Hook.process('user', 'bug/comments.html.tmpl') %]
        </td>
        <td class="comment-actions">
          [% IF user.is_insider && bug.check_can_change_field('longdesc', 0, 1) %]
            [% IF comment.is_private %]
              <div class="comment-private edit-hide bz_private">
                Private
              </div>
            [% END %]
            <div class="comment-private edit-show" style="display:none">
              <input type="hidden" value="1" name="defined_isprivate_[% comment.id FILTER none %]">
              <input type="checkbox" name="isprivate_[% comment.id FILTER none %]"
                  id="is-private-[% comment.id FILTER none %]"
                  class="is-private" value="1" [%= "checked" IF comment.is_private %]>
              <label for="is-private-[% comment.id FILTER none %]">Private</label>
            </div>
          [% END %]
          [% IF user.id %]
            <button class="reply-btn in-page"
              data-reply-id="[% comment.count FILTER none %]"
              data-reply-name="[% comment.author.name || comment.author.moz_nick FILTER html %]"
              >Reply</button>
          [% END %]
          <button class="comment-spinner in-page" id="cs-[% comment.count FILTER none%]">-</button>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="change-name">
            <a href="show_bug.cgi?id=[% bug.bug_id FILTER none %]#c[% comment.count FILTER none %]">
              [% comment.count == 0 ? "Description" : "Comment " _ comment.count ~%]
            </a>
          </div>
          &bull;
          <div class="change-time">
            [% INCLUDE bug_modal/rel_time.html.tmpl ts=comment.creation_ts %]
          </div>
        </td>
      </tr>
      [% IF comment.tags.size %]
        <tr>
          <td colspan="2" class="comment-tags">
            [% FOREACH tag IN comment.tags %]
              <span class="comment-tag">[% tag FILTER html %]</span>
            [% END %]
          </td>
        </tr>
      [% END %]
    </table>

    [%# default-collapsed comment header %]
    [% IF comment.collapsed %]
      <table class="layout-table change-head default-collapsed" id="cc-[% comment.count FILTER none %]">
      <tr>
        <td class="comment-collapse-reason"
            title="[% comment.author.moz_nick FILTER html %] [[% comment.creation_ts FILTER time_duration FILTER html %]]">
            Comment hidden ([% comment.tags.join(', ') FILTER html %])
        </td>
        <td class="comment-actions">
          <button class="comment-spinner in-page" id="ccs-[% comment.count FILTER none%]">
            [%~ comment.collapsed ? "+" : "-" ~%]
          </button>
        </td>
      </tr>
      </table>
    [% END %]
  </div>
[% END %]

[% BLOCK activity_header %]
  [% action = activities.0 %]
  <div id="[% id FILTER none %]" class="change">
    <table class="layout-table change-head [% extra_class FILTER none %]">
      <tr>
        <td rowspan="2" class="change-gravatar">
          [% INCLUDE bug_modal/user.html.tmpl
              u = action.who
              gravatar_size = 32
              gravatar_only = 1
          %]
        </td>
        <td class="change-author">
          [% INCLUDE bug_modal/user.html.tmpl
              u = action.who
          %]
          [% IF extra_class %]
            <span class="user-role">([% extra_class.ucfirst FILTER none %])</span>
          [% END %]
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="change-name">
            <a href="show_bug.cgi?id=[% bug.bug_id FILTER none %]#[% id FILTER none %]">Updated</a>
          </div>
          &bull;
          <div class="change-time">
            [% INCLUDE bug_modal/rel_time.html.tmpl ts=action.when %]
          </div>
        </td>
      </tr>
    </table>
  </div>
[% END %]

[% BLOCK comment_body %]
  <pre class="comment-text [%= "bz_private" IF comment.is_private %]" id="ct-[% comment.count FILTER none %]"
    [% IF comment.collapsed +%] style="display:none"[% END ~%]
  >[% comment.body_full FILTER quoteUrls(bug, comment) %]</pre>
[% END %]

[%
  BLOCK activity_body;
    '<div class="activity">';
    has_cc = 0;

    FOREACH change IN activity.changes;
      '<div class="change">';
      class = "";

      IF change.fieldname == 'cc';
        has_cc = 1;
        class = "activity-cc";
      END;

      IF change.attachid;
        %]
        <a href="attachment.cgi?id=[% change.attachid FILTER none %]&amp;action=edit"
           title="[% change.attach.description FILTER html %]"
           class="[% "bz_obsolete" IF change.attach.isobsoletee %]"
        >Attachment #[% change.attachid FILTER none %]</a> -
        [%+
      END;

      IF change.buglist;
        IF change.fieldname == 'duplicate';
          label = "Duplicate of this " _ terms.bug;
        ELSE;
          label = field_descs.${change.fieldname};
        END;
        IF change.added != '';
          label _ ": " FILTER html;
          PROCESS add_change value=change.added;
        END;
        IF change.removed != '';
          IF change.added != '';
            "<br>";
          END;
          "No longer ";
          label FILTER lcfirst;
          ": ";
          PROCESS add_change value=change.removed;
        END;

      ELSE;
        IF change.fieldname == 'longdescs.isprivate';
          # reference the comment that was made private/public in the field label
          %]
          <a href="#c[% change.comment.count FILTER none %]">
            Comment [% change.comment.count FILTER none %]</a> is private:
          [%+
        ELSE;
          field_descs.${change.fieldname} _ ": " FILTER html;
        END;

        IF change.removed != '';
          IF change.added == '';
            '<span class="activity-deleted">';
          END;
          PROCESS add_change value=change.removed;
          IF change.added == '';
            '</span>';
          ELSE;
            ' &rarr; ';
          END;
        END;
        PROCESS add_change value=change.added;
      END;

      '</div>';
    END;
    '</div>';
  END;

  BLOCK add_change;
    SWITCH change.fieldname;

      CASE [ 'estimated_time', 'remaining_time', 'work_time' ];
        PROCESS formattimeunit time_unit=value;

      CASE 'bug_file_loc';
        %]
        <a href="[% value FILTER html %]" target="_blank" rel="noreferrer"
        [% UNLESS is_safe_url(value) %]
          onclick="return confirmUnsafeURL(this.href)"
        [% END %]
        >[% value FILTER truncate(256, '&hellip;') FILTER html %]</a>
        [%

      CASE 'see_also';
        FOREACH see_also IN value;
          IF see_also.bug_id;
            "$terms.bug $see_also.bug_id" FILTER bug_link(see_also.bug_id);
          ELSE;
            %]
            <a href="[% see_also.url FILTER html %]" target="_blank">[% see_also.url FILTER html %]</a>
            [%
          END;
          ", " UNLESS loop.last;
        END;

      CASE [ 'assigned_to', 'reporter', 'qa_contact', 'cc', 'flagtypes.name' ];
        value FILTER email;

      CASE;
        IF change.fieldtype == constants.FIELD_TYPE_DATETIME;
          INCLUDE bug_modal/rel_time.html.tmpl ts=value;

        ELSIF change.buglist;
          value FILTER bug_list_link;

        ELSE;
          value FILTER truncate(256, '&hellip;') FILTER html;

        END;
    END;
  END;
%]