elsa-workflows / elsa-workflows/elsa-core

[BUG] BookmarksDeleted notification not send on index (Elsa 2.14.1)

Open
#5,408 1 comment 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
On indexing bookmarks there are no any notifications BookmarksDeleted for removed bookmarks

## Steps to Reproduce
execute method IndexBookmarksAsync() in class BookmarkIndexer.cs

This method removes **oldBookmarks** and creates new(**bookmarks**):

```
entities.AddRange(bookmarks);

await _bookmarkStore.AddManyAsync(entities, cancellationToken);
var oldBookmarkIds = oldBookmarks.Select(x => x.Id).ToList();
await _bookmarkStore.DeleteManyAsync(new BookmarkIdsSpecification(oldBookmarkIds), cancellationToken);
await _publisher.Publish(new BookmarksDeleted(workflowInstanceId, bookmarks), cancellationToken);
_logger.LogDebug("Deleted {DeletedBookmarkCount} bookmarks for workflow {WorkflowInstanceId}", bookmarks.Count, workflowInstanceId);
await _publisher.Publish(new BookmarkIndexingFinished(workflowInstanceId, bookmarks), cancellationToken);
```

But BookmarksDeleted notification sends NOT for oldBookmarks, but for 'entities' - bookmars that created.

Is it bug at code?
May be correct code is:
await _publisher.Publish(new BookmarksDeleted(workflowInstanceId, **oldBookmarks**), cancellationToken);

## Expected Behavior
BookmarksDeleted send for deleted bookmars

## Actual Behavior
BookmarksDeleted don't send for actually deleted bookmars

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.