Skip to content
Snippets Groups Projects
Commit 98dc5d9b authored by aydreeihn's avatar aydreeihn
Browse files

Collaborator Tickets Visibility Fix:

This commit fixes the counts in the Web Portal based on which Tickets the User has access to.
parent e9db21a5
No related branches found
No related tags found
No related merge requests found
...@@ -321,6 +321,7 @@ class EndUser extends BaseAuthenticatedUser { ...@@ -321,6 +321,7 @@ class EndUser extends BaseAuthenticatedUser {
} }
private function getStats() { private function getStats() {
global $cfg;
$basic = Ticket::objects() $basic = Ticket::objects()
->annotate(array('count' => SqlAggregate::COUNT('ticket_id'))) ->annotate(array('count' => SqlAggregate::COUNT('ticket_id')))
->values('status__state', 'topic_id') ->values('status__state', 'topic_id')
...@@ -338,10 +339,11 @@ class EndUser extends BaseAuthenticatedUser { ...@@ -338,10 +339,11 @@ class EndUser extends BaseAuthenticatedUser {
// one index. Therefore, to scan two indexes (by user_id and // one index. Therefore, to scan two indexes (by user_id and
// thread.collaborators.user_id), we need two queries. A union will // thread.collaborators.user_id), we need two queries. A union will
// help out with that. // help out with that.
$mine->union($collab->filter(array( if ($cfg->collaboratorTicketsVisibility())
'thread__collaborators__user_id' => $this->getId(), $mine->union($collab->filter(array(
Q::not(array('user_id' => $this->getId())) 'thread__collaborators__user_id' => $this->getId(),
))); Q::not(array('user_id' => $this->getId()))
)));
if ($orgid = $this->getOrgId()) { if ($orgid = $this->getOrgId()) {
// Also generate a separate query for all the tickets owned by // Also generate a separate query for all the tickets owned by
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment