(core) Bug with empty, self-referencing RefList columns.

Summary:
If a table T contains a RefList:T showing RowId and there
are any empty cells, the table can't be removed.

Test Plan: Added new test

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4215
This commit is contained in:
Jarosław Sadziński
2024-03-20 17:48:46 +01:00
parent 07fcce548b
commit ff8477cbe4
3 changed files with 38 additions and 5 deletions

View File

@@ -1178,7 +1178,7 @@ class UserActions(object):
# to strings containing comma-separated row IDs.
# We need to get the values before changing the column type.
table = self._engine.tables[table_id]
new_values = [",".join(map(str, row)) for row in self._get_column_values(col)]
new_values = [",".join(map(str, row or [])) for row in self._get_column_values(col)]
self.ModifyColumn(table_id, col_id, dict(type="Text"))
self.BulkUpdateRecord(table_id, list(table.row_ids), {col_id: new_values})
return