|
@@ -1,4 +1,4 @@
|
|
|
-import {Fragment, useCallback, useState} from 'react';
|
|
|
+import {Fragment, useCallback, useMemo, useState} from 'react';
|
|
|
import styled from '@emotion/styled';
|
|
|
|
|
|
import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator';
|
|
@@ -7,7 +7,6 @@ import {NoteInputWithStorage} from 'sentry/components/activity/note/inputWithSto
|
|
|
import useMutateActivity from 'sentry/components/feedback/useMutateActivity';
|
|
|
import Timeline from 'sentry/components/timeline';
|
|
|
import TimeSince from 'sentry/components/timeSince';
|
|
|
-import {IconFlag} from 'sentry/icons/iconFlag';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import GroupStore from 'sentry/stores/groupStore';
|
|
|
import {space} from 'sentry/styles/space';
|
|
@@ -83,6 +82,37 @@ function StreamlinedActivitySection({group}: {group: Group}) {
|
|
|
[group.activity, mutators, group.id]
|
|
|
);
|
|
|
|
|
|
+ const activities = useMemo(() => {
|
|
|
+ const lastSeenActivity: GroupActivity = {
|
|
|
+ type: GroupActivityType.LAST_SEEN,
|
|
|
+ id: uniqueId(),
|
|
|
+ dateCreated: group.lastSeen,
|
|
|
+ project: group.project,
|
|
|
+ data: {},
|
|
|
+ };
|
|
|
+
|
|
|
+ const groupActivities = [...group.activity, lastSeenActivity];
|
|
|
+ return groupActivities.sort((a, b) => {
|
|
|
+ const dateA = new Date(a.dateCreated).getTime();
|
|
|
+ const dateB = new Date(b.dateCreated).getTime();
|
|
|
+ if (
|
|
|
+ a.type === GroupActivityType.FIRST_SEEN &&
|
|
|
+ b.type === GroupActivityType.LAST_SEEN
|
|
|
+ ) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ a.type === GroupActivityType.LAST_SEEN &&
|
|
|
+ b.type === GroupActivityType.FIRST_SEEN
|
|
|
+ ) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return dateB - dateA;
|
|
|
+ });
|
|
|
+ // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
+ }, [group.activity.length, group.lastSeen, group.project]);
|
|
|
+
|
|
|
return (
|
|
|
<Fragment>
|
|
|
<Timeline.Container>
|
|
@@ -97,12 +127,7 @@ function StreamlinedActivitySection({group}: {group: Group}) {
|
|
|
source="issue-details"
|
|
|
{...noteProps}
|
|
|
/>
|
|
|
- <ActivityTimelineItem
|
|
|
- title={t('Last Seen')}
|
|
|
- icon={<IconFlag size="xs" />}
|
|
|
- timestamp={<SmallTimestamp date={group.lastSeen} />}
|
|
|
- />
|
|
|
- {group.activity.map(item => {
|
|
|
+ {activities.map(item => {
|
|
|
const authorName = item.user ? item.user.name : 'Sentry';
|
|
|
const {title, message} = getGroupActivityItem(
|
|
|
item,
|