Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,44 @@ import type {
import {GroupActivityType} from 'sentry/types/group';

interface IconWithDefaultProps {
Component: React.ComponentType<SVGIconProps> | null;
Component: React.ComponentType<any> | null;
defaultProps: {locked?: boolean; type?: string};
componentFunction?: (props: {
data: GroupActivity['data'];
sentry_app: GroupActivity['sentry_app'];
user: GroupActivity['user'];
}) => React.ComponentType<SVGIconProps>;
propsFunction?: (data: GroupActivity['data']) => Record<string, unknown>;
propsFunction?: (
data: GroupActivity['data'],
user?: GroupActivity['user'],
sentry_app?: GroupActivity['sentry_app']
) => Record<string, unknown>;
}

function NoteActivityIcon({
user,
sentry_app,
}: {
sentry_app: GroupActivity['sentry_app'];
user: GroupActivity['user'];
}) {
if (sentry_app) {
return <SentryAppAvatar sentryApp={sentry_app} />;
}
if (user) {
return <StyledUserAvatar user={user} />;
}
return <IconChat size="xs" />;
}

export const groupActivityTypeIconMapping: Record<
GroupActivityType,
IconWithDefaultProps
> = {
[GroupActivityType.NOTE]: {
Component: IconChat,
Component: NoteActivityIcon,
defaultProps: {},
componentFunction: ({user, sentry_app}) => {
if (sentry_app) {
return function () {
return <SentryAppAvatar sentryApp={sentry_app} />;
};
}
return user ? () => <StyledUserAvatar user={user} /> : IconChat;
},
propsFunction: (_, user, sentry_app) => ({user, sentry_app}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The call to propsFunction in progressActivityTooltip.tsx was not updated after a refactor, causing it to be called with incomplete arguments for GroupActivityType.NOTE.
Severity: MEDIUM

Suggested Fix

Update the call to propsFunction in progressActivityTooltip.tsx at line 100 to pass all required arguments. Change iconMapping.propsFunction?.(item.data) to iconMapping.propsFunction?.(item.data, item.user, item.sentry_app) to match the updated signature.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/issueDetails/activitySection/groupActivityIcons.tsx#L82

Potential issue: A refactor updated the signature of `propsFunction` for
`GroupActivityType.NOTE` to accept `data`, `user`, and `sentry_app` as arguments. While
the call site in `index.tsx` was correctly updated to pass all three, the call site in
`progressActivityTooltip.tsx` was missed and still only passes `item.data`.
Consequently, when a note activity created by a user or Sentry app is displayed in the
progress tooltip, the `user` and `sentry_app` arguments will be `undefined`. This causes
the `NoteActivityIcon` to fall back to rendering a generic chat icon instead of the
correct user or Sentry app avatar, resulting in a functional regression.

Also affects:

  • static/app/views/issueList/progressActivityTooltip.tsx:100

Did we get this right? 👍 / 👎 to inform future reviews.

},
[GroupActivityType.SET_RESOLVED]: {Component: IconCheckmark, defaultProps: {}},
[GroupActivityType.SET_RESOLVED_BY_AGE]: {Component: IconCheckmark, defaultProps: {}},
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/issueDetails/activitySection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function LegacyTimelineItem({
Icon && (
<Icon
{...iconMapping.defaultProps}
{...iconMapping.propsFunction?.(item.data)}
{...iconMapping.propsFunction?.(item.data, item.user, item.sentry_app)}
size="xs"
/>
)
Expand Down
Loading