Skip to content

Commit c2364b3

Browse files
committed
Bug 1150358 - cannot remove other people from the cc list
1 parent 0c703a9 commit c2364b3

File tree

6 files changed

+66
-5
lines changed

6 files changed

+66
-5
lines changed

extensions/BugModal/lib/WebService.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ sub cc {
127127
my $template = Bugzilla->template;
128128
my $bug = Bugzilla::Bug->check({ id => $params->{id} });
129129
my $vars = {
130+
bug => $bug,
130131
cc_list => [
131-
sort { lc($a->moz_nick) cmp lc($b->moz_nick) }
132+
sort { lc($a->identity) cmp lc($b->identity) }
132133
@{ $bug->cc_users }
133134
]
134135
};

extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,20 @@
99
[%
1010
UNLESS cc_list.size;
1111
'None';
12-
END;
13-
FOREACH cc IN cc_list;
14-
INCLUDE bug_modal/user.html.tmpl u=cc;
12+
RETURN;
1513
END;
1614
%]
15+
16+
[% FOREACH cc IN cc_list %]
17+
<div class="cc-user" data-n="[% loop.count FILTER none %]">
18+
[% IF bug.user.canedit %]
19+
<a href="#" id="ccr-[% loop.count FILTER none %]" class="cc-remove"
20+
data-n="[% loop.count FILTER none %]" data-login="[% cc.login FILTER html %]"
21+
title="Remove" style="visibility:hidden">&nbsp;&#x2716;&nbsp;</a>
22+
[% END %]
23+
[% INCLUDE bug_modal/user.html.tmpl
24+
u = cc
25+
id = "ccu-" _ loop.count
26+
%]
27+
</div>
28+
[% END %]

extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@
617617
[% END %]
618618

619619
[% IF bug.cc && bug.cc.size %]
620+
<input type="hidden" name="removecc" id="removecc">
620621
<span id="cc-latch">&#9656;</span>
621622
<span id="cc-summary">
622623
[%

extensions/BugModal/template/en/default/bug_modal/user.html.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# gravatar_size : size of the gravator icon (default 0, which disables the gravatar)
1313
# gravatar_only : boolean, if true output just the gravatar (not-simple only)
1414
# nick_only : boolean, if true, the nickname will be used instead of the full name
15+
# id : string, if provided the id of the vcard div
1516
#%]
1617

1718
[%
@@ -24,7 +25,7 @@ IF user.settings.show_gravatars.value != 'On';
2425
gravatar_size = 0;
2526
END;
2627
%]
27-
<div class="vcard vcard_[% u.id FILTER none %]">
28+
<div class="vcard vcard_[% u.id FILTER none %]" [% IF id %]id="[% id FILTER html %]"[% END %]>
2829
[% FILTER collapse %]
2930

3031
[% IF simple %]

extensions/BugModal/web/bug_modal.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,23 @@ input[type="number"] {
323323
max-height: 150px;
324324
overflow-y: auto;
325325
clear: both;
326+
white-space: nowrap;
327+
}
328+
329+
#cc-list .vcard {
330+
display: inline-block;
331+
}
332+
333+
#cc-list button {
334+
padding: 2px 4px;
335+
}
336+
337+
.cc-remove {
338+
font-size: 120%;
339+
}
340+
341+
.cc-removed {
342+
text-decoration: line-through;
326343
}
327344

328345
#add-cc-btn {

extensions/BugModal/web/bug_modal.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,35 @@ $(function() {
166166
function(data) {
167167
$('#cc-list').html(data.html);
168168
latch.data('fetched', true);
169+
$('#cc-list .cc-user').hover(
170+
function() {
171+
$('#ccr-' + $(this).data('n')).css('visibility', 'visible');
172+
},
173+
function() {
174+
$('#ccr-' + $(this).data('n')).css('visibility', 'hidden');
175+
}
176+
);
177+
$('#cc-list .cc-remove')
178+
.click(function(event) {
179+
event.preventDefault();
180+
$('#top-save-btn').show();
181+
var n = $(this).data('n');
182+
var ccu = $('#ccu-' + n);
183+
if (ccu.hasClass('cc-removed')) {
184+
ccu.removeClass('cc-removed');
185+
$('#cc-' + n).remove();
186+
}
187+
else {
188+
$('#removecc').val('on');
189+
ccu.addClass('cc-removed');
190+
$('<input>').attr({
191+
type: 'hidden',
192+
id: 'cc-' + n,
193+
value: $('#ccr-' + n).data('login'),
194+
name: 'cc'
195+
}).appendTo('#changeform');
196+
}
197+
});
169198
}
170199
);
171200
}

0 commit comments

Comments
 (0)