From be277ba318f65c02331fd819b0b9370c3b84d923 Mon Sep 17 00:00:00 2001 From: Caio Almeida <117518+caiosba@users.noreply.github.com> Date: Fri, 10 May 2024 16:57:02 -0300 Subject: [PATCH] Inverting the logic of the feed workspace filter for clusters (#1887) It should exclude unselected workspaces, instead of returning clusters with all other selected workspaces. Fixes CV2-4601. --- app/models/feed.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/feed.rb b/app/models/feed.rb index be7e2c1be0..3fd3b5b618 100755 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -143,7 +143,7 @@ def filtered_clusters(args = {}) query = self.clusters # Filter by workspace - query = query.where("ARRAY[?] && team_ids", team_ids.to_a.map(&:to_i)) unless team_ids.blank? + query = query.where.not("ARRAY[?] && team_ids", self.team_ids - team_ids.to_a.map(&:to_i)) if !team_ids.blank? && team_ids != self.team_ids query = query.where(team_ids: []) if team_ids&.empty? # Invalidate the query # Filter by channel