From 4bf6789bd7083ad25cc8f517d107bdf8d98cd481 Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Fri, 21 Jan 2022 15:56:45 -0700 Subject: [PATCH] DEV: Do not use hard-coded everyone group id (#15679) Follow up to: 12f041de5d5ff147e82ab3d16132f0f5ad06d389 Probably best to lookup the "everyone" group_id instead of hard-coding it to `0`. Also now its more clear what this `0` means. --- app/models/tag_user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/tag_user.rb b/app/models/tag_user.rb index b1e62ca7792..d9437ec9f4a 100644 --- a/app/models/tag_user.rb +++ b/app/models/tag_user.rb @@ -11,10 +11,11 @@ class TagUser < ActiveRecord::Base .joins("LEFT OUTER JOIN tag_group_permissions ON tag_group_memberships.tag_group_id = tag_group_permissions.tag_group_id") .joins("LEFT OUTER JOIN group_users on group_users.user_id = tag_users.user_id") .where("(tag_group_permissions.group_id IS NULL - OR tag_group_permissions.group_id IN (0, group_users.group_id) + OR tag_group_permissions.group_id IN (:everyone_group_id, group_users.group_id) OR group_users.group_id = :staff_group_id) AND tag_users.notification_level IN (:notification_levels)", staff_group_id: Group::AUTO_GROUPS[:staff], + everyone_group_id: Group::AUTO_GROUPS[:everyone], notification_levels: notification_levels) }