Fix: Fixed incorrect re-direction link in mention tab (#24025)

* Fix: Fixed incorrect re-direction link in mention tab

* Fix: minor fix
This commit is contained in:
Rohit Jain 2025-10-28 19:17:03 +05:30 committed by GitHub
parent a34f50a6d0
commit b94d3be456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 1 deletions

View File

@ -73,6 +73,7 @@ const NotificationBox = ({
let actualUser = mainFeed.from; let actualUser = mainFeed.from;
let actualTimestamp = mainFeed.postTs; let actualTimestamp = mainFeed.postTs;
let feedType = feed.type || ThreadType.Conversation; let feedType = feed.type || ThreadType.Conversation;
const isConversationFeed = feed.type === ThreadType.Conversation;
if ( if (
activeTab === ThreadType.Conversation && activeTab === ThreadType.Conversation &&
@ -100,6 +101,7 @@ const NotificationBox = ({
entityFQN={entityFQN as string} entityFQN={entityFQN as string}
entityType={entityType as string} entityType={entityType as string}
feedType={feedType} feedType={feedType}
isConversationFeed={isConversationFeed}
key={`${actualUser} ${mainFeed.id}`} key={`${actualUser} ${mainFeed.id}`}
task={feed} task={feed}
timestamp={actualTimestamp} timestamp={actualTimestamp}

View File

@ -37,6 +37,7 @@ const NotificationFeedCard: FC<NotificationFeedProp> = ({
timestamp, timestamp,
feedType, feedType,
task, task,
isConversationFeed = false,
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { task: taskDetails } = task ?? {}; const { task: taskDetails } = task ?? {};
@ -95,7 +96,7 @@ const NotificationFeedCard: FC<NotificationFeedProp> = ({
<Link <Link
className="no-underline" className="no-underline"
to={ to={
feedType === ThreadType.Conversation isConversationFeed
? prepareFeedLink(entityType, entityFQN, ActivityFeedTabs.ALL) ? prepareFeedLink(entityType, entityFQN, ActivityFeedTabs.ALL)
: getTaskDetailPath(task) : getTaskDetailPath(task)
}> }>

View File

@ -21,4 +21,5 @@ export interface NotificationFeedProp
entityType: string; entityType: string;
entityFQN: string; entityFQN: string;
timestamp?: number; timestamp?: number;
isConversationFeed?: boolean;
} }

View File

@ -224,6 +224,7 @@ describe('Test NotificationFeedCard Component', () => {
const conversationProps = { const conversationProps = {
...mockProps, ...mockProps,
feedType: ThreadType.Conversation, feedType: ThreadType.Conversation,
isConversationFeed: true,
}; };
await act(async () => { await act(async () => {
@ -243,6 +244,25 @@ describe('Test NotificationFeedCard Component', () => {
expect(linkElement).toHaveAttribute('data-to', conversationUrl); expect(linkElement).toHaveAttribute('data-to', conversationUrl);
}); });
it('should call getTaskDetailPath for task feed entity links in mention notifications tab', async () => {
const entityLinkUrl = '/database/test.entity/activity_feed/all';
mockPrepareFeedLink.mockReturnValue(entityLinkUrl);
const conversationProps = {
...mockProps,
feedType: ThreadType.Conversation,
isConversationFeed: false,
};
await act(async () => {
render(<NotificationFeedCard {...conversationProps} />);
});
// Should be called twice - once for main link, once for entity name link
expect(mockGetTaskDetailPath).toHaveBeenCalledTimes(2);
expect(mockGetTaskDetailPath).toHaveBeenCalledWith(mockThread);
});
it('should call prepareFeedLink with ALL subtab for entity links in conversation notifications', async () => { it('should call prepareFeedLink with ALL subtab for entity links in conversation notifications', async () => {
const entityLinkUrl = '/database/test.entity/activity_feed/all'; const entityLinkUrl = '/database/test.entity/activity_feed/all';
mockPrepareFeedLink.mockReturnValue(entityLinkUrl); mockPrepareFeedLink.mockReturnValue(entityLinkUrl);
@ -250,6 +270,7 @@ describe('Test NotificationFeedCard Component', () => {
const conversationProps = { const conversationProps = {
...mockProps, ...mockProps,
feedType: ThreadType.Conversation, feedType: ThreadType.Conversation,
isConversationFeed: true,
}; };
await act(async () => { await act(async () => {