Mark profiles as edited when importing settings into them
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/safing/portbase/api"
|
"github.com/safing/portbase/api"
|
||||||
"github.com/safing/portbase/config"
|
"github.com/safing/portbase/config"
|
||||||
@@ -253,6 +254,9 @@ func ImportSingeSetting(r *SingleSettingImportRequest) (*ImportResult, error) {
|
|||||||
// Set imported setting on profile.
|
// Set imported setting on profile.
|
||||||
config.PutValueIntoHierarchicalConfig(p.Config, r.Export.ID, r.Export.Value)
|
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.
|
// Save profile back to db.
|
||||||
if err := p.Save(); err != nil {
|
if err := p.Save(); err != nil {
|
||||||
return nil, fmt.Errorf("%w: failed to save profile: %w", ErrImportFailed, err)
|
return nil, fmt.Errorf("%w: failed to save profile: %w", ErrImportFailed, err)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/safing/portbase/api"
|
"github.com/safing/portbase/api"
|
||||||
"github.com/safing/portbase/config"
|
"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.
|
// Save profile back to db.
|
||||||
err = p.Save()
|
err = p.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user