mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-27 05:37:15 -05:00
PLT-6882 Disable /invite_people when account creation is set to false (#6709)
* PLT-6882 Disable /invite_people when account creation is set to false * Disable /invite_people when account creation or email notifications are set to false
This commit is contained in:
@@ -28,9 +28,13 @@ func (me *InvitePeopleProvider) GetTrigger() string {
|
||||
}
|
||||
|
||||
func (me *InvitePeopleProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
|
||||
autoComplete := true
|
||||
if !utils.Cfg.EmailSettings.SendEmailNotifications || !utils.Cfg.TeamSettings.EnableUserCreation {
|
||||
autoComplete = false
|
||||
}
|
||||
return &model.Command{
|
||||
Trigger: CMD_INVITE_PEOPLE,
|
||||
AutoComplete: true,
|
||||
AutoComplete: autoComplete,
|
||||
AutoCompleteDesc: T("api.command.invite_people.desc"),
|
||||
AutoCompleteHint: T("api.command.invite_people.hint"),
|
||||
DisplayName: T("api.command.invite_people.name"),
|
||||
@@ -42,6 +46,10 @@ func (me *InvitePeopleProvider) DoCommand(args *model.CommandArgs, message strin
|
||||
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.email_off")}
|
||||
}
|
||||
|
||||
if !utils.Cfg.TeamSettings.EnableUserCreation {
|
||||
return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: args.T("api.command.invite_people.invite_off")}
|
||||
}
|
||||
|
||||
emailList := strings.Fields(message)
|
||||
|
||||
for i := len(emailList) - 1; i >= 0; i-- {
|
||||
|
||||
@@ -451,6 +451,10 @@
|
||||
"id": "api.command.invite_people.email_off",
|
||||
"translation": "Email has not been configured, no invite(s) sent"
|
||||
},
|
||||
{
|
||||
"id": "api.command.invite_people.invite_off",
|
||||
"translation": "User creation has been disabled on this server, no invite(s) sent"
|
||||
},
|
||||
{
|
||||
"id": "api.command.invite_people.fail",
|
||||
"translation": "Encountered an error sending email invite(s)"
|
||||
|
||||
Reference in New Issue
Block a user