diff --git a/include/ajax.thread.php b/include/ajax.thread.php index 470f9276e24a6d3c4c15a7d054422799db70c9b1..7850c67c0b6c5acb4667661ee5934e7e7cc7a150 100644 --- a/include/ajax.thread.php +++ b/include/ajax.thread.php @@ -230,9 +230,13 @@ class ThreadAjaxAPI extends AjaxController { $errors = $info = array(); if ($thread->updateCollaborators($_POST, $errors)) - Http::response(201, sprintf('Recipients (%d of %d)', - $thread->getNumActiveCollaborators(), - $thread->getNumCollaborators())); + Http::response(201, $this->json_encode(array( + 'id' => $thread->getId(), + 'text' => sprintf('Recipients (%d of %d)', + $thread->getNumActiveCollaborators(), + $thread->getNumCollaborators()) + ) + )); if($errors && $errors['err']) $info +=array('error' => $errors['err']); diff --git a/include/class.thread.php b/include/class.thread.php index 31b2c5c3df702e43a2855bf736c7d93141a6b24d..b6fc9b5f15504d779dc7619d0e4a6fc384ab8bd2 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -197,15 +197,13 @@ class Thread extends VerySimpleModel { )); } - if ($cids) { - $this->collaborators->filter(array( - 'thread_id' => $this->getId(), - Q::not(array('id__in' => $cids)) - ))->update(array( - 'updated' => SqlFunction::NOW(), - 'isactive' => 0, - )); - } + $this->collaborators->filter(array( + 'thread_id' => $this->getId(), + Q::not(array('id__in' => $cids ?: array(0))) + ))->update(array( + 'updated' => SqlFunction::NOW(), + 'isactive' => 0, + )); unset($this->ht['active_collaborators']); $this->_collaborators = null; diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 36c1d34ef922b6606fa3df26c61f73a3cd4893b1..62ac75e116a99c49ec2f3dfac78039584765331f 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -583,7 +583,8 @@ if ($errors['err'] && isset($_POST['a'])) { <label><strong><?php echo __('Collaborators'); ?>:</strong></label> </td> <td> - <input type='checkbox' value='1' name="emailcollab" id="emailcollab" + <input type='checkbox' value='1' name="emailcollab" + id="t<?php echo $ticket->getThreadId(); ?>-emailcollab" <?php echo ((!$info['emailcollab'] && !$errors) || isset($info['emailcollab']))?'checked="checked"':''; ?> style="display:<?php echo $ticket->getThread()->getNumCollaborators() ? 'inline-block': 'none'; ?>;" > diff --git a/scp/js/scp.js b/scp/js/scp.js index 1e2dfa304ef14df52bd445a9bbb91e4797dc2b29..3c04b4a9cb6e17d33fd1ea22841433c1c5aaabbc 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -987,8 +987,9 @@ $(document).on('click', 'a.collaborator, a.collaborators', function(e) { e.preventDefault(); var url = 'ajax.php/'+$(this).attr('href').substr(1); $.dialog(url, 201, function (xhr) { - $('input#emailcollab').show(); - $('#recipients').text(xhr.responseText); + var resp = $.parseJSON(xhr.responseText); + $('input#t'+resp.id+'-emailcollab').show(); + $('#t'+resp.id+'-recipients').text(resp.text); $('.tip_box').remove(); }, { onshow: function() { $('#user-search').focus(); }