FIX: If a group is unmentionable, don't render it as mentionable

Now if a group is visible but unmentionable, users can search for it
when composing by typing with `@`, but it will be rendered without the
grey background color.

It will also no longer pop up a JIT warning saying "You are about to
mention X people" because the group will not be mentioned.
This commit is contained in:
Robin Ward
2020-02-14 12:27:46 -05:00
parent c31039d51f
commit d51107e2c9
5 changed files with 28 additions and 10 deletions

View File

@ -308,7 +308,7 @@ class UsersController < ApplicationController
groups = Group.where(name: usernames).pluck(:name)
mentionable_groups =
if current_user
Group.mentionable(current_user)
Group.mentionable(current_user, include_public: false)
.where(name: usernames)
.pluck(:name, :user_count)
.map do |name, user_count|