discord: also check disabled users in housekeeping daemon

externally disabled users will also be checked and de-roled by the discord daemon.
pull/297/head
Harvey Tindall 4 months ago
parent 448955c915
commit 28ca02272c
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -32,7 +32,7 @@ func (app *appContext) clearDiscord() {
app.debug.Println(lm.HousekeepingDiscord)
discordUsers := app.storage.GetDiscord()
for _, discordUser := range discordUsers {
_, _, err := app.jf.UserByID(discordUser.JellyfinID, false)
user, _, err := app.jf.UserByID(discordUser.JellyfinID, false)
// Make sure the user doesn't exist, and no other error has occured
switch err.(type) {
case mediabrowser.ErrUserNotFound:
@ -40,6 +40,9 @@ func (app *appContext) clearDiscord() {
app.discord.RemoveRole(discordUser.MethodID().(string))
app.storage.DeleteDiscordKey(discordUser.JellyfinID)
default:
if user.Policy.IsDisabled {
app.discord.RemoveRole(discordUser.MethodID().(string))
}
continue
}
}

Loading…
Cancel
Save