From 28ca02272ce843d96a6ca6564673e4d678cec7a4 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sun, 4 Aug 2024 15:48:01 +0100 Subject: [PATCH] discord: also check disabled users in housekeeping daemon externally disabled users will also be checked and de-roled by the discord daemon. --- housekeeping-d.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/housekeeping-d.go b/housekeeping-d.go index 9538b7e..47123aa 100644 --- a/housekeeping-d.go +++ b/housekeeping-d.go @@ -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 } }