]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1150358 - cannot remove other people from the cc list
authorByron Jones <glob@mozilla.com>
Mon, 12 Oct 2015 04:53:40 +0000 (12:53 +0800)
committerByron Jones <glob@mozilla.com>
Mon, 12 Oct 2015 04:53:40 +0000 (12:53 +0800)
extensions/BugModal/lib/WebService.pm
extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
extensions/BugModal/template/en/default/bug_modal/user.html.tmpl
extensions/BugModal/web/bug_modal.css
extensions/BugModal/web/bug_modal.js

index 2461cf2fa88ba8c41b08bf26f40c7e002fc0da34..e85225f60c7d524e0f4753079f35774f572f4627 100644 (file)
@@ -127,8 +127,9 @@ sub cc {
     my $template = Bugzilla->template;
     my $bug = Bugzilla::Bug->check({ id => $params->{id} });
     my $vars = {
+        bug     => $bug,
         cc_list => [
-            sort { lc($a->moz_nick) cmp lc($b->moz_nick) }
+            sort { lc($a->identity) cmp lc($b->identity) }
             @{ $bug->cc_users }
         ]
     };
index 37f582e0e89fe529254e40ddc3d7d9e7234f8a82..ceb6e3b62236ea513eb6ba53a004d317ac2c5399 100644 (file)
@@ -9,8 +9,20 @@
 [%
   UNLESS cc_list.size;
     'None';
-  END;
-  FOREACH cc IN cc_list;
-    INCLUDE bug_modal/user.html.tmpl u=cc;
+    RETURN;
   END;
 %]
+
+[% FOREACH cc IN cc_list %]
+  <div class="cc-user" data-n="[% loop.count FILTER none %]">
+    [% IF bug.user.canedit %]
+      <a href="#" id="ccr-[% loop.count FILTER none %]" class="cc-remove"
+        data-n="[% loop.count FILTER none %]" data-login="[% cc.login FILTER html %]"
+        title="Remove" style="visibility:hidden">&nbsp;&#x2716;&nbsp;</a>
+    [% END %]
+    [% INCLUDE bug_modal/user.html.tmpl
+          u  = cc
+          id = "ccu-" _ loop.count
+    %]
+  </div>
+[% END %]
index 5d148a7dde001eeb7c197ce4c30cd7190765c7cb..ddf37a26c3c728beb543cca29806ebc2b472eb4b 100644 (file)
       [% END %]
 
       [% IF bug.cc && bug.cc.size %]
+        <input type="hidden" name="removecc" id="removecc">
         <span id="cc-latch">&#9656;</span>
         <span id="cc-summary">
           [%
index 062276614979d9883551cd1899e0b809cc5be610..4c28936cc0903bf0bb075d210447fa36ece59eb2 100644 (file)
@@ -12,6 +12,7 @@
   # gravatar_size : size of the gravator icon (default 0, which disables the gravatar)
   # gravatar_only : boolean, if true output just the gravatar (not-simple only)
   # nick_only : boolean, if true, the nickname will be used instead of the full name
+  # id : string, if provided the id of the vcard div
   #%]
 
 [%
@@ -24,7 +25,7 @@ IF user.settings.show_gravatars.value != 'On';
   gravatar_size = 0;
 END;
 %]
-<div class="vcard vcard_[% u.id FILTER none %]">
+<div class="vcard vcard_[% u.id FILTER none %]" [% IF id %]id="[% id FILTER html %]"[% END %]>
   [% FILTER collapse %]
 
     [% IF simple %]
index 21d8a34d0e8f548673a22afdd8eed3b1429299bd..9090945d3494ece393327c65da072ff72936831c 100644 (file)
@@ -323,6 +323,23 @@ input[type="number"] {
     max-height: 150px;
     overflow-y: auto;
     clear: both;
+    white-space: nowrap;
+}
+
+#cc-list .vcard {
+    display: inline-block;
+}
+
+#cc-list button {
+    padding: 2px 4px;
+}
+
+.cc-remove {
+    font-size: 120%;
+}
+
+.cc-removed {
+    text-decoration: line-through;
 }
 
 #add-cc-btn {
index 098450cd926d359fb7b861f83fe89fc8a731c5b9..74ee83312d88f5b197e411c26c38232b958c5da2 100644 (file)
@@ -166,6 +166,35 @@ $(function() {
                         function(data) {
                             $('#cc-list').html(data.html);
                             latch.data('fetched', true);
+                            $('#cc-list .cc-user').hover(
+                                function() {
+                                    $('#ccr-' + $(this).data('n')).css('visibility', 'visible');
+                                },
+                                function() {
+                                    $('#ccr-' + $(this).data('n')).css('visibility', 'hidden');
+                                }
+                            );
+                            $('#cc-list .cc-remove')
+                                .click(function(event) {
+                                    event.preventDefault();
+                                    $('#top-save-btn').show();
+                                    var n = $(this).data('n');
+                                    var ccu = $('#ccu-' + n);
+                                    if (ccu.hasClass('cc-removed')) {
+                                        ccu.removeClass('cc-removed');
+                                        $('#cc-' + n).remove();
+                                    }
+                                    else {
+                                        $('#removecc').val('on');
+                                        ccu.addClass('cc-removed');
+                                        $('<input>').attr({
+                                            type: 'hidden',
+                                            id: 'cc-' + n,
+                                            value: $('#ccr-' + n).data('login'),
+                                            name: 'cc'
+                                        }).appendTo('#changeform');
+                                    }
+                                });
                         }
                     );
                 }