Fixed MM-42027 (#19619)
* [MM-42027] - Invitation Email is resent as a Reminder after invalidating pending email invites * generate app layers mocks * add tests * improve err handling * fix translations * change status code
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3c48be040f
Коммит
81f82729d2
22
app/team.go
22
app/team.go
@@ -1901,11 +1901,29 @@ func (a *App) RemoveTeamIcon(teamID string) *model.AppError {
|
||||
|
||||
func (a *App) InvalidateAllEmailInvites() *model.AppError {
|
||||
if err := a.Srv().Store.Token().RemoveAllTokensByType(TokenTypeTeamInvitation); err != nil {
|
||||
return model.NewAppError("InvalidateAllEmailInvites", "api.team.invalidate_all_email_invites.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
return model.NewAppError("InvalidateAllEmailInvites", "api.team.invalidate_all_email_invites.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
if err := a.Srv().Store.Token().RemoveAllTokensByType(TokenTypeGuestInvitation); err != nil {
|
||||
return model.NewAppError("InvalidateAllEmailInvites", "api.team.invalidate_all_email_invites.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
return model.NewAppError("InvalidateAllEmailInvites", "api.team.invalidate_all_email_invites.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
if err := a.InvalidateAllResendInviteEmailJobs(); err != nil {
|
||||
return model.NewAppError("InvalidateAllEmailInvites", "api.team.invalidate_all_email_invites.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) InvalidateAllResendInviteEmailJobs() *model.AppError {
|
||||
jobs, appErr := a.Srv().Jobs.GetJobsByTypeAndStatus(model.JobTypeResendInvitationEmail, model.JobStatusPending)
|
||||
if appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
|
||||
for _, j := range jobs {
|
||||
a.Srv().Jobs.SetJobCanceled(j)
|
||||
// clean up any system values this job was using
|
||||
a.Srv().Store.System().PermanentDeleteByName(j.Id)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user