mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-14 00:57:09 +00:00
parent
0a80820742
commit
23e0aff20c
@ -198,7 +198,11 @@ public class FeedRepository {
|
|||||||
List<Post> posts = thread.getPosts();
|
List<Post> posts = thread.getPosts();
|
||||||
// Remove the post to be deleted from the posts list
|
// Remove the post to be deleted from the posts list
|
||||||
posts = posts.stream().filter(p -> !p.getId().equals(post.getId())).collect(Collectors.toList());
|
posts = posts.stream().filter(p -> !p.getId().equals(post.getId())).collect(Collectors.toList());
|
||||||
thread.withUpdatedAt(System.currentTimeMillis()).withUpdatedBy(userName).withPosts(posts);
|
thread
|
||||||
|
.withUpdatedAt(System.currentTimeMillis())
|
||||||
|
.withUpdatedBy(userName)
|
||||||
|
.withPosts(posts)
|
||||||
|
.withPostsCount(posts.size());
|
||||||
// update the json document
|
// update the json document
|
||||||
dao.feedDAO().update(thread.getId().toString(), JsonUtils.pojoToJson(thread));
|
dao.feedDAO().update(thread.getId().toString(), JsonUtils.pojoToJson(thread));
|
||||||
|
|
||||||
|
|||||||
@ -483,6 +483,10 @@ public class FeedResourceTest extends CatalogApplicationTest {
|
|||||||
// Check if get posts API returns the post
|
// Check if get posts API returns the post
|
||||||
PostList postList = listPosts(thread.getId().toString(), AUTH_HEADERS);
|
PostList postList = listPosts(thread.getId().toString(), AUTH_HEADERS);
|
||||||
assertTrue(postList.getData().isEmpty());
|
assertTrue(postList.getData().isEmpty());
|
||||||
|
|
||||||
|
// validate posts count
|
||||||
|
Thread getThread = getThread(thread.getId(), AUTH_HEADERS);
|
||||||
|
assertEquals(0, getThread.getPostsCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user