~singpolyma/cheogram

259ebb8705f17a17bcaa8e8a157dc9cb4ed4c210 — Stephen Paul Weber 2 months ago df65a43
Remove cheoJid/owner when removing route

Since we no longer have any reason to believe this JID owns that tel anymore,
and also can't check anymore anyway, so just remove it.
1 files changed, 4 insertions(+), 0 deletions(-)

M Main.hs
M Main.hs => Main.hs +4 -0
@@ 2110,6 2110,10 @@ main = do
						Nothing -> do
							maybeExistingRoute <- (parseJID =<<) <$> DB.get db (DB.byJid userJid' ["direct-message-route"])
							DB.del db (DB.byJid userJid' ["direct-message-route"])
							mcheoJid <- fmap (parseJID =<<) $ DB.get db (DB.byJid userJid' ["cheoJid"])
							forM_ mcheoJid $ \cheoJid -> do
								DB.del db (DB.byJid userJid' ["cheoJid"])
								DB.srem db (DB.byNode cheoJid ["owners"]) [bareTxt userJid']
							forM_ maybeExistingRoute $ \existingRoute ->
								atomically . writeTChan sendToComponent . mkStanzaRec =<< unregisterDirectMessageRoute db componentJid userJid' existingRoute
				)