When receiving DomainChanged: change or add the domain to you domain list.

This commit is contained in:
Philippe PITTOLI 2024-04-28 00:25:39 +02:00
parent ea2160b857
commit 67d0ca700f

View File

@ -407,7 +407,10 @@ handleQuery = case _ of
handleAction $ UpdateMyDomains (my_domains <> [ emptyDomainInfo { name = response.domain } ]) handleAction $ UpdateMyDomains (my_domains <> [ emptyDomainInfo { name = response.domain } ])
(DNSManager.MkDomainChanged response) -> do (DNSManager.MkDomainChanged response) -> do
{ my_domains } <- H.get { my_domains } <- H.get
let new_domains = map (\d -> if d.name == response.domain.name then response.domain else d) my_domains let replaced_domains = map (\d -> if d.name == response.domain.name then response.domain else d) my_domains
new_domains = if A.elem response.domain replaced_domains
then replaced_domains
else replaced_domains <> [response.domain]
handleAction $ UpdateMyDomains new_domains handleAction $ UpdateMyDomains new_domains
(DNSManager.MkDomainDeleted response) -> do (DNSManager.MkDomainDeleted response) -> do
{ my_domains } <- H.get { my_domains } <- H.get