Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export const NotificationRow: React.FC<IProps> = ({
unsubscribeNotification(notification.id, hostname);
};

const openUserProfile = (event: React.MouseEvent<HTMLElement>) => {
// Don't trigger onClick of parent element.
event.stopPropagation();

openExternalLink(notification.subject.user.html_url);
};

const reason = formatReason(notification.reason);
const NotificationIcon = getNotificationTypeIcon(notification.subject);
const iconColor = getNotificationTypeIconColor(notification.subject);
Expand Down Expand Up @@ -80,11 +87,10 @@ export const NotificationRow: React.FC<IProps> = ({
<NotificationIcon size={18} aria-label={notification.subject.type} />
</div>

<div className="flex-1 overflow-hidden">
<div className="flex-1 overflow-hidden" onClick={() => pressTitle()}>
<div
className="mb-1 text-sm whitespace-nowrap overflow-ellipsis overflow-hidden cursor-pointer"
role="main"
onClick={() => pressTitle()}
title={notification.subject.title}
>
{notification.subject.title}
Expand All @@ -101,9 +107,7 @@ export const NotificationRow: React.FC<IProps> = ({
<span
className="cursor-pointer"
title="View User Profile"
onClick={() =>
openExternalLink(notification.subject.user.html_url)
}
onClick={openUserProfile}
>
{notification.subject.user.login}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`]
</div>
<div
className="flex-1 overflow-hidden"
onClick={[Function]}
>
<div
className="mb-1 text-sm whitespace-nowrap overflow-ellipsis overflow-hidden cursor-pointer"
onClick={[Function]}
role="main"
title="I am a robot and this is a test!"
>
Expand Down