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

View File

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

View File

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

View File

@ -224,6 +224,7 @@ describe('Test NotificationFeedCard Component', () => {
const conversationProps = {
...mockProps,
feedType: ThreadType.Conversation,
isConversationFeed: true,
};
await act(async () => {
@ -243,6 +244,25 @@ describe('Test NotificationFeedCard Component', () => {
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 () => {
const entityLinkUrl = '/database/test.entity/activity_feed/all';
mockPrepareFeedLink.mockReturnValue(entityLinkUrl);
@ -250,6 +270,7 @@ describe('Test NotificationFeedCard Component', () => {
const conversationProps = {
...mockProps,
feedType: ThreadType.Conversation,
isConversationFeed: true,
};
await act(async () => {