mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
update profile when hostname changes
This commit is contained in:
parent
643417eb1e
commit
758dcfb3c8
@ -27,12 +27,12 @@ func SetNodeConfig(w http.ResponseWriter, r *http.Request) {
|
||||
err := store.DB.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// upsert domain config
|
||||
if res := tx.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "config_id"}},
|
||||
DoUpdates: clause.AssignmentColumns([]string{"str_value"}),
|
||||
}).Create(&store.Config{ConfigID: CNFDomain, StrValue: config.Domain}).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
if res := tx.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "config_id"}},
|
||||
DoUpdates: clause.AssignmentColumns([]string{"str_value"}),
|
||||
}).Create(&store.Config{ConfigID: CNFDomain, StrValue: config.Domain}).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
|
||||
// upsert account storage config
|
||||
if res := tx.Clauses(clause.OnConflict{
|
||||
@ -132,6 +132,9 @@ func SetNodeConfig(w http.ResponseWriter, r *http.Request) {
|
||||
if res := tx.Model(account).Update("account_revision", account.AccountRevision+1).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
if res := tx.Model(account).Update("profile_revision", account.ProfileRevision+1).Error; res != nil {
|
||||
return res
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
@ -34,7 +34,7 @@ func SendNotifications() {
|
||||
select {
|
||||
case notification := <-notify:
|
||||
node := getStrConfigValue(CNFDomain, "")
|
||||
if notification.Node == node {
|
||||
if notification.Node == "" || notification.Node == node {
|
||||
sendLocalNotification(notification)
|
||||
} else {
|
||||
sendRemoteNotification(notification)
|
||||
|
Loading…
Reference in New Issue
Block a user