fix bug with empty buttons array being mistaken as [], and add /api/devices/batch.
This commit is contained in:
@@ -259,6 +259,10 @@ func (r *DeviceRepo) populate(ctx context.Context, records []deviceRecord) ([]mo
|
||||
Tags: make([]string, 0, 8),
|
||||
}
|
||||
|
||||
if device.ButtonNames[0] == "" {
|
||||
device.ButtonNames = device.ButtonNames[:0]
|
||||
}
|
||||
|
||||
caps := make([]models.DeviceCapability, 0, 16)
|
||||
for _, capStr := range strings.Split(record.Capabilities, ",") {
|
||||
caps = append(caps, models.DeviceCapability(capStr))
|
||||
|
||||
Reference in New Issue
Block a user