fix peer add if group not existing

This commit is contained in:
Pascal Fischer
2025-07-03 15:40:28 +02:00
parent dfad334780
commit fee36b0663
2 changed files with 28 additions and 28 deletions

View File

@@ -1827,16 +1827,16 @@ func (s *SqlStore) SaveGroup(ctx context.Context, lockStrength LockingStrength,
group.StoreGroupPeers()
if err := s.db.Model(group).Association("GroupPeers").Replace(group.GroupPeers); err != nil {
log.WithContext(ctx).Errorf("failed to replace peers for group %s: %v", group.ID, err)
return status.Errorf(status.Internal, "failed to sync group peers")
}
if err := s.db.Save(group).Error; err != nil {
log.WithContext(ctx).Errorf("failed to save group to store: %v", err)
return status.Errorf(status.Internal, "failed to save group to store")
}
if err := s.db.Model(group).Association("GroupPeers").Replace(group.GroupPeers); err != nil {
log.WithContext(ctx).Errorf("failed to replace peers for group %s: %v", group.ID, err)
return status.Errorf(status.Internal, "failed to sync group peers")
}
return nil
}