This repository was archived by the owner on Jul 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -887,11 +887,13 @@ module ::DiscourseAssign
887887 Assignment . active_for_group ( group ) . destroy_all
888888 end
889889
890- add_filter_custom_filter ( "assigned" ) do |scope , filter_values |
890+ add_filter_custom_filter ( "assigned" ) do |scope , filter_values , guardian |
891+ return if !guardian . can_assign? || filter_values . blank?
892+
891893 user_or_group_name = filter_values . compact . first
892894
893- return scope if user_or_group_name . blank?
894-
895+ return if user_or_group_name . blank?
896+
895897 if user_id = User . find_by_username ( user_or_group_name ) &.id
896898 scope . where ( <<~SQL , user_id )
897899 topics.id IN (SELECT a.topic_id FROM assignments a WHERE a.assigned_to_id = ? AND a.assigned_to_type = 'User' AND a.active)
@@ -900,8 +902,6 @@ module ::DiscourseAssign
900902 scope . where ( <<~SQL , group_id )
901903 topics.id IN (SELECT a.topic_id FROM assignments a WHERE a.assigned_to_id = ? AND a.assigned_to_type = 'Group' AND a.active)
902904 SQL
903- else
904- scope
905905 end
906906 end
907907
@@ -913,7 +913,7 @@ module ::DiscourseAssign
913913
914914 register_search_advanced_filter ( /in:unassigned/ ) do |posts |
915915 return if !@guardian . can_assign?
916-
916+
917917 posts . where ( "topics.id NOT IN (SELECT a.topic_id FROM assignments a WHERE a.active)" )
918918 end
919919
You can’t perform that action at this time.
0 commit comments