Skip to content

List: delete data in subfolders#7563

Open
labkey-nicka wants to merge 2 commits intorelease26.3-SNAPSHOTfrom
26.3_fb_list_delete
Open

List: delete data in subfolders#7563
labkey-nicka wants to merge 2 commits intorelease26.3-SNAPSHOTfrom
26.3_fb_list_delete

Conversation

@labkey-nicka
Copy link
Copy Markdown
Contributor

Rationale

This addresses #1013 by truncating rows across all lists that are in scope within a folder when the folder is deleted.

Changes

  • Truncate rows across all lists in scope in a folder that is being deleted
  • Relax deleteRelatedListData() implementation to be defensive of orphaned rows containing no-longer-valid containers
  • Consolidate list deletion logic into ListManager
  • Regression test

void deleteList(User user, @NotNull ListDefinitionImpl list, @Nullable String auditUserComment) throws DomainNotFoundException
{
var table = list.getTable(user);
var container = list.getContainer();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was not formerly a permissions check here for if the user could delete from this container but it seems like we could/should.

filter.addCondition(FieldKey.fromParts("EntityId"), null, CompareType.NONBLANK);

// Delete attachments associated with a list in batches
new TableSelector(getDbTable(), new CsvSet("Container, EntityId"), filter, null).forEachBatch(ListRow.class, 1_000, rows -> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we really need AttachmentService.deleteAttachments(SQLFragment sqlAttachmentParents)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants