The Banzai User Reference Filter filters namespace paths not usersnames
Summary
When using the @user syntax to refer to a user in a text input field Banzai tries to find a namespace of name "user" instead of the actual user. This is in contrast to what the documentation of UserReferenceFilter / user_link_filter
and friends in lib/banzai/filter/user_reference_filter.rb
suggests:
Replace
@user
user references in text with links to the referenced user's profile page.text - String text to replace references in. link_content - Original content of the link being replaced.
Returns a String with
@user
references replaced with links. All links havegfm
andgfm-project_member
class names attached for styling.
Also, this is in contrast to what the input pop-down menu does. It lists users that match the entered text. Email is still sent correctly to the referred user when referring to a user in a MR discussion, etc.
Obviously, this problem will only show if namespace name and username are not identical.
Steps to reproduce
- Change the name of a user without changing the name of the associated workspace.
- New user name
- Create a merge request comment referencing the new user-name using
@user
notation. - Click Preview
- namespace path
1.Create a merge request comment referencing the user's namespace path using
@user
notation. - Click Preview
What is the current bug behavior?
- For 2. above: The expected link to the user's profile page is not created
- For 3. above: A link to the user's former (when username and profile path were identical) profile page is created but does not work due to it having moved to the new location.
What is the expected correct behavior?
- For 2. above: A link to the user's profile page is created
- For 3. above: No link is created
Output of checks
Results of GitLab environment info
System information
System: Ubuntu 16.04
Current User: gitlab
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.5.1
Bundler Version:1.13.6
Rake Version: 10.5.0
Redis Version: 3.0.6
Sidekiq Version:4.2.7
GitLab information
Version: 8.17.4
Revision: slightly modified version
Directory: /home/gitlab/gitlab
DB Adapter: postgresql
URL:
HTTP Clone URL:
SSH Clone URL:
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 4.1.1
Repository storage paths:
- default: /home/gitlab/repositories/
Hooks: /home/gitlab/gitlab-shell/hooks/
Git: /usr/bin/git
Results of GitLab application Check
Will provide if required.