remove todo comments

This commit is contained in:
Henry Dollman
2024-11-29 17:16:40 -05:00
parent 617a03fc15
commit 6e08507dde
5 changed files with 6 additions and 7 deletions

View File

@@ -511,7 +511,6 @@ func sliceContains(slice []string, item string) bool {
return false return false
} }
// todo: test
func (am *AlertManager) SendTestNotification(e *core.RequestEvent) error { func (am *AlertManager) SendTestNotification(e *core.RequestEvent) error {
info, _ := e.RequestInfo() info, _ := e.RequestInfo()
if info.Auth == nil { if info.Auth == nil {

View File

@@ -210,7 +210,6 @@ func (h *Hub) getUserEmailMap(userIDs []string) (map[string]string, error) {
// Returns the current config.yml file as a JSON object // Returns the current config.yml file as a JSON object
func (h *Hub) getYamlConfig(e *core.RequestEvent) error { func (h *Hub) getYamlConfig(e *core.RequestEvent) error {
info, _ := e.RequestInfo() info, _ := e.RequestInfo()
// todo: test
if info.Auth == nil || info.Auth.GetString("role") != "admin" { if info.Auth == nil || info.Auth.GetString("role") != "admin" {
return apis.NewForbiddenError("Forbidden", nil) return apis.NewForbiddenError("Forbidden", nil)
} }

View File

@@ -80,13 +80,15 @@ func (h *Hub) Run() {
return err return err
} }
// disable email auth if DISABLE_PASSWORD_AUTH env var is set // disable email auth if DISABLE_PASSWORD_AUTH env var is set
// todo: test email login and DISABLE_PASSWORD_AUTH env var (do we need to save usersCollection?)
if os.Getenv("DISABLE_PASSWORD_AUTH") == "true" { if os.Getenv("DISABLE_PASSWORD_AUTH") == "true" {
usersCollection.PasswordAuth.Enabled = false usersCollection.PasswordAuth.Enabled = false
} else { } else {
usersCollection.PasswordAuth.Enabled = true usersCollection.PasswordAuth.Enabled = true
usersCollection.PasswordAuth.IdentityFields = []string{"email"} usersCollection.PasswordAuth.IdentityFields = []string{"email"}
} }
if err := h.app.Save(usersCollection); err != nil {
return err
}
// sync systems with config // sync systems with config
h.syncSystemsWithConfig() h.syncSystemsWithConfig()
return se.Next() return se.Next()
@@ -318,7 +320,7 @@ func (h *Hub) updateSystem(record *core.Record) {
} }
} }
// system info alerts (todo: extra fs alerts) // system info alerts
if err := h.am.HandleSystemAlerts(record, systemData.Info, systemData.Stats.Temperatures, systemData.Stats.ExtraFs); err != nil { if err := h.am.HandleSystemAlerts(record, systemData.Info, systemData.Stats.Temperatures, systemData.Stats.ExtraFs); err != nil {
h.app.Logger().Error("System alerts error", "err", err.Error()) h.app.Logger().Error("System alerts error", "err", err.Error())
} }

View File

@@ -27,7 +27,7 @@ func NewUserManager(app *pocketbase.PocketBase) *UserManager {
} }
} }
// todo: test // Initialize user role if not set
func (um *UserManager) InitializeUserRole(e *core.RecordEvent) error { func (um *UserManager) InitializeUserRole(e *core.RecordEvent) error {
if e.Record.GetString("role") == "" { if e.Record.GetString("role") == "" {
e.Record.Set("role", "user") e.Record.Set("role", "user")
@@ -35,7 +35,7 @@ func (um *UserManager) InitializeUserRole(e *core.RecordEvent) error {
return e.Next() return e.Next()
} }
// todo: test // Initialize user settings with defaults if not set
func (um *UserManager) InitializeUserSettings(e *core.RecordEvent) error { func (um *UserManager) InitializeUserSettings(e *core.RecordEvent) error {
record := e.Record record := e.Record
// intialize settings with defaults // intialize settings with defaults

View File

@@ -18,7 +18,6 @@ export default function Home() {
const alerts = useStore($alerts) const alerts = useStore($alerts)
const systems = useStore($systems) const systems = useStore($systems)
// todo: maybe remove active alert if changed
const activeAlerts = useMemo(() => { const activeAlerts = useMemo(() => {
const activeAlerts = alerts.filter((alert) => { const activeAlerts = alerts.filter((alert) => {
const active = alert.triggered && alert.name in alertInfo const active = alert.triggered && alert.name in alertInfo