diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts index 4dcc3330578..0c751f81a62 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts @@ -565,6 +565,76 @@ test.describe('Activity feed', () => { ); }); + test('User 1 mentions user 2 and user 2 sees correct usernames in feed replies', async ({ + browser, + }) => { + const { page: page1, afterAction: afterActionUser1 } = + await performUserLogin(browser, adminUser); + const { page: page2, afterAction: afterActionUser2 } = + await performUserLogin(browser, user2); + + await test.step('User 1 mentions user 2 in a feed reply', async () => { + // Add mention comment in feed mentioning user2 + await addMentionCommentInFeed(page1, user2.responseData.name); + + await page1.locator('[data-testid="closeDrawer"]').click(); + + await afterActionUser1(); + }); + + await test.step('User 2 logs in and checks @Mentions tab', async () => { + await redirectToHomePage(page2); + await page2.waitForLoadState('networkidle'); + + const fetchMentionsFeedResponse = page2.waitForResponse( + '/api/v1/feed?filterType=MENTIONS&userId=*' + ); + await page2 + .locator('[data-testid="activity-feed-widget"]') + .locator('text=@Mentions') + .click(); + + await fetchMentionsFeedResponse; + + // Verify the mention appears in the feed + await expect( + page2.locator('[data-testid="message-container"]').first() + ).toBeVisible(); + + // Click on the feed to open replies + await page2.locator('[data-testid="reply-count"]').first().click(); + + await page2.waitForSelector('.ant-drawer-content', { + state: 'visible', + }); + + // Verify the feed reply card shows correct usernames + await expect( + page2.locator('[data-testid="feed-reply-card"]').first() + ).toBeVisible(); + + // Check that the reply shows the correct username (user1 who made the mention) + await expect( + page2 + .locator('[data-testid="feed-reply-card"] .reply-card-user-name') + .first() + ).toContainText(adminUser.responseData.displayName); + + // Check that the mention text contains user2's name + await expect( + page2 + .locator( + '[data-testid="feed-replies"] [data-testid="markdown-parser"]' + ) + .first() + ).toContainText(`@${user2.responseData.name}`); + + await page2.locator('[data-testid="closeDrawer"]').click(); + + await afterActionUser2(); + }); + }); + test('Check Task Filter in Landing Page Widget', async ({ browser }) => { const { page: page1, afterAction: afterActionUser1 } = await performUserLogin(browser, user1); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCardNew/CommentCard.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCardNew/CommentCard.component.tsx index 1d23af41c12..d6aa6a7a038 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCardNew/CommentCard.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCardNew/CommentCard.component.tsx @@ -81,7 +81,7 @@ const CommentCard = ({ const [, , user] = useUserProfile({ permission: true, - name: feed.updatedBy ?? '', + name: post.from ?? '', }); const onEditPost = () => { @@ -138,19 +138,19 @@ const CommentCard = ({ onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
- +
- +
- + + to={getUserPath(post.from ?? '')}> {getEntityName(user)}