FIX: Suggest only groups that are visible to current user (#48)

FIX: Suggest only groups that are visible to current user (#48)

Otherwise, the user would search in groups that were not visible, operation which resulted in a 403 error.

diff --git a/app/controllers/discourse_assign/assign_controller.rb b/app/controllers/discourse_assign/assign_controller.rb
index f9c7a2c..1553902 100644
--- a/app/controllers/discourse_assign/assign_controller.rb
+++ b/app/controllers/discourse_assign/assign_controller.rb
@@ -24,7 +24,7 @@ module DiscourseAssign
         .limit(6)
 
       render json: {
-        assign_allowed_on_groups: Group.assign_allowed_groups.pluck(:name),
+        assign_allowed_on_groups: current_user.visible_groups.assign_allowed_groups.pluck(:name),
         suggestions: ActiveModel::ArraySerializer.new(users, scope: guardian, each_serializer: BasicUserSerializer)
       }
     end

GitHub sha: 7d4b5155

Can we follow up with a spec?

DEV: Test if assign_allowed_on_groups contains only visible groups