Request to join email is sent to non-owner group members

Summary

Using a group, team members that have "Master" role will receive an email whenever someone asks to join the group, even if they don't have permission to approve that request

Steps to reproduce

Create a group and set someone as Master. Another person requests to join the group

What is the current bug behavior?

An email is sent to everybody with Master and Owner permissions

What is the expected correct behavior?

If a person can't approve a request, then he shouldn't get an email

Relevant logs and/or screenshots

image

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

GitLab Enterprise Edition 9.0.0-rc5-ee 5003abb

Assignee Loading
Time tracking Loading