Mark profiles as edited when importing settings into them

This commit is contained in:
Daniel
2023-10-20 10:24:27 +02:00
parent 8cb44bb11d
commit 89cf31e40e
2 changed files with 8 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"time"
"github.com/safing/portbase/api"
"github.com/safing/portbase/config"
@@ -253,6 +254,9 @@ func ImportSingeSetting(r *SingleSettingImportRequest) (*ImportResult, error) {
// Set imported setting on profile.
config.PutValueIntoHierarchicalConfig(p.Config, r.Export.ID, r.Export.Value)
// Mark profile as edited by user.
p.LastEdited = time.Now().Unix()
// Save profile back to db.
if err := p.Save(); err != nil {
return nil, fmt.Errorf("%w: failed to save profile: %w", ErrImportFailed, err)

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"strings"
"time"
"github.com/safing/portbase/api"
"github.com/safing/portbase/config"
@@ -322,6 +323,9 @@ func ImportSettings(r *SettingsImportRequest) (*ImportResult, error) {
}
}
// Mark profile as edited by user.
p.LastEdited = time.Now().Unix()
// Save profile back to db.
err = p.Save()
if err != nil {