MM-56774: Delete file along with bookmark (#27495)

This commit is contained in:
Caleb Roseland 2024-07-03 09:31:39 -04:00 committed by GitHub
parent 762ff9b96c
commit 90534b13cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -317,7 +317,6 @@ func (s *SqlChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) err
From("ChannelBookmarks"). From("ChannelBookmarks").
Where(sq.And{ Where(sq.And{
sq.Eq{"Id": bookmarkId}, sq.Eq{"Id": bookmarkId},
sq.Eq{"DeleteAt": 0},
}) })
fileQuery, fileArgs, fileErr := s.getQueryBuilder(). fileQuery, fileArgs, fileErr := s.getQueryBuilder().

View File

@ -434,6 +434,11 @@ func testDeleteChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) {
err = ss.ChannelBookmark().Delete(bookmark2.Id, true) err = ss.ChannelBookmark().Delete(bookmark2.Id, true)
assert.NoError(t, err) assert.NoError(t, err)
_, err = ss.FileInfo().Get(file.Id)
assert.Error(t, err)
var nfErr *store.ErrNotFound
assert.ErrorAs(t, err, &nfErr)
bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelId, now) bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelId, now)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, bookmarks, 2) // we have two as the deleted record also gets returned for sync'ing purposes assert.Len(t, bookmarks, 2) // we have two as the deleted record also gets returned for sync'ing purposes