[MM-14725] Inform System Admins when a user who managed bot ac… (#11669)
* Add notification, to sysadmins, when a user is disabled and the user owns bots. * If the user doesn't have any bots, there is no need to send a notifcation to sysadmins * Remove comment * Update documention link * Send as System * Query teams for each sysadmin and add first response to hardcoded link. * Remove fmt.print debug statements * remove link with hard-coded team. Will add this as future enhancement Expose GetDisableBotSysadminMessage function so it can be tested Add test new function for testing new notification feature * Fix shadow error * Swap sentences in the message when System Console > Bot Accounts > Disable bot accounts when owner is deactivated: is set to false * Another message correction * Rename Custom Integrations to Integrations * rename botsDisabled variable to disableBotsSetting * - increase the number of bots and sysadmins queried to 1000. - limit the number of bots printed in the post to 10, but mention the total bots owned by the user * Enable translations for sysadmin messages * - Rename function. The actual purpose for the function is to notify sysadmins that a user, that owned bots, was disabled. - convert GetDisableBotSysadminMessage from a function to a method. This allows getting *a.Config().ServiceSettings.DisableBotsWhenOwnerIsDeactivated in the method and avoids having to pass the value as an input to a function * fix "make i18n-extract" error. Reorganize .json file * Correct the upper range value to be the minimum of number of elements in the userBots array, or the upper limit (10) * replace t.fatal with require statements fix golangci-lint errors * Create separate message when user managed less than or fewer than 10 bots Test cases for both message types * fix i18n sorting * Using pagination to get the bots and sysadmins instead of setting arbitrary value for PerPage and only retrieving first page * only use one translation ID for the message. push all logic into the template so translators can view the logic add disableBotsSetting and printAllBots variables to the translation map * Break the for loop once len(bots) < perPage value, instead of breaking once there are no bots. This saves one additional call
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
345b0c560a
Коммит
876cf82bad
@@ -243,6 +243,7 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
|
||||
switch o.Type {
|
||||
case
|
||||
POST_DEFAULT,
|
||||
POST_SYSTEM_GENERIC,
|
||||
POST_JOIN_LEAVE,
|
||||
POST_AUTO_RESPONDER,
|
||||
POST_ADD_REMOVE,
|
||||
|
||||
Ссылка в новой задаче
Block a user