Deactivate page on delete

This commit is contained in:
tyler 2024-05-29 10:52:53 -04:00
parent bb5098f472
commit 142ced1d3a

View file

@ -913,13 +913,12 @@ func (a *App) DeleteAccount(id int64) error {
return fmt.Errorf("Error deleting account. Try again.") return fmt.Errorf("Error deleting account. Try again.")
} }
if a.producers.ApiP.Active(*name) { // Assumes page is active when delete is called.
err := a.producers.ApiP.Stop(*name) err = a.activatePage(acct)
if err != nil { if err != nil {
a.logError.Println("error stopping api:", err) a.logError.Println("error de-activating page:", err)
return fmt.Errorf("Error deleting account. Try again.") return fmt.Errorf("Error deleting account. Try again.")
} }
}
err = a.services.AccountS.Delete(acct) err = a.services.AccountS.Delete(acct)
if err != nil { if err != nil {
@ -955,12 +954,11 @@ func (a *App) DeleteChannel(id int64) error {
return fmt.Errorf("Error deleting channel. Try again.") return fmt.Errorf("Error deleting channel. Try again.")
} }
if a.producers.ApiP.Active(*name) { // Assumes page is active when delete is called.
err := a.producers.ApiP.Stop(*name) err = a.activatePage(channel)
if err != nil { if err != nil {
a.logError.Println("error stopping api:", err) a.logError.Println("error de-activating page:", err)
return fmt.Errorf("Error deleting channel. Try again.") return fmt.Errorf("Error deleting account. Try again.")
}
} }
err = a.services.ChannelS.Delete(channel) err = a.services.ChannelS.Delete(channel)