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
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
648f333850
Коммит
84d5f314a0
@@ -28,9 +28,13 @@ func (me *InvitePeopleProvider) GetTrigger() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (me *InvitePeopleProvider) GetCommand(T goi18n.TranslateFunc) *model.Command {
|
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{
|
return &model.Command{
|
||||||
Trigger: CMD_INVITE_PEOPLE,
|
Trigger: CMD_INVITE_PEOPLE,
|
||||||
AutoComplete: true,
|
AutoComplete: autoComplete,
|
||||||
AutoCompleteDesc: T("api.command.invite_people.desc"),
|
AutoCompleteDesc: T("api.command.invite_people.desc"),
|
||||||
AutoCompleteHint: T("api.command.invite_people.hint"),
|
AutoCompleteHint: T("api.command.invite_people.hint"),
|
||||||
DisplayName: T("api.command.invite_people.name"),
|
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")}
|
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)
|
emailList := strings.Fields(message)
|
||||||
|
|
||||||
for i := len(emailList) - 1; i >= 0; i-- {
|
for i := len(emailList) - 1; i >= 0; i-- {
|
||||||
|
|||||||
@@ -451,6 +451,10 @@
|
|||||||
"id": "api.command.invite_people.email_off",
|
"id": "api.command.invite_people.email_off",
|
||||||
"translation": "Email has not been configured, no invite(s) sent"
|
"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",
|
"id": "api.command.invite_people.fail",
|
||||||
"translation": "Encountered an error sending email invite(s)"
|
"translation": "Encountered an error sending email invite(s)"
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user