mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
housekeeping/discord: respect remove role on disable setting
only remove it if it's set to true.
This commit is contained in:
@@ -31,6 +31,7 @@ func (app *appContext) clearEmails() {
|
||||
func (app *appContext) clearDiscord() {
|
||||
app.debug.Println(lm.HousekeepingDiscord)
|
||||
discordUsers := app.storage.GetDiscord()
|
||||
removeRoleOnDisable := app.config.Section("discord").Key("disable_enable_role").MustBool(false)
|
||||
for _, discordUser := range discordUsers {
|
||||
user, err := app.jf.UserByID(discordUser.JellyfinID, false)
|
||||
// Make sure the user doesn't exist, and no other error has occured
|
||||
@@ -40,7 +41,7 @@ func (app *appContext) clearDiscord() {
|
||||
app.discord.RemoveRole(discordUser.MethodID().(string))
|
||||
app.storage.DeleteDiscordKey(discordUser.JellyfinID)
|
||||
default:
|
||||
if user.Policy.IsDisabled {
|
||||
if removeRoleOnDisable && user.Policy.IsDisabled {
|
||||
app.discord.RemoveRole(discordUser.MethodID().(string))
|
||||
}
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user