diff --git a/packages/sanity/src/tasks/__telemetry__/tasks.telemetry.ts b/packages/sanity/src/tasks/__telemetry__/tasks.telemetry.ts index 7edb7750c67..1ddaf5d5280 100644 --- a/packages/sanity/src/tasks/__telemetry__/tasks.telemetry.ts +++ b/packages/sanity/src/tasks/__telemetry__/tasks.telemetry.ts @@ -17,15 +17,6 @@ export const TaskStatusChanged = defineEvent<{ description: 'Task status changed', }) -// A comment is added in a task -export const TaskCommentAdded = defineEvent<{ - is_reply: boolean -}>({ - name: 'Task Comment Added', - version: 1, - description: 'A comment was added in a task', -}) - // A task is duplicated export const TaskDuplicated = defineEvent({ name: 'Task Duplicated', diff --git a/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityLog.tsx b/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityLog.tsx index d172976e96e..d9b2f58583e 100644 --- a/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityLog.tsx +++ b/packages/sanity/src/tasks/src/tasks/components/activity/TasksActivityLog.tsx @@ -1,4 +1,3 @@ -import {useTelemetry} from '@sanity/telemetry/react' import {Box, Flex, Stack, Text} from '@sanity/ui' import {uuid} from '@sanity/uuid' import {AnimatePresence, motion, type Variants} from 'framer-motion' @@ -25,7 +24,6 @@ import { type CommentUpdatePayload, useComments, } from '../../../../../structure/comments' -import {TaskCommentAdded} from '../../../../__telemetry__/tasks.telemetry' import {tasksLocaleNamespace} from '../../../../i18n' import {type TaskDocument} from '../../types' import {getMentionedUsers} from '../form/utils' @@ -67,7 +65,7 @@ type Activity = export function TasksActivityLog(props: TasksActivityLogProps) { const {value, onChange, path, activityData = []} = props const currentUser = useCurrentUser() - const telemetry = useTelemetry() + const {title: workspaceTitle, basePath} = useWorkspace() const {comments, mentionOptions, operation, getComment} = useComments() const [commentToDeleteId, setCommentToDeleteId] = useState(null) @@ -118,12 +116,9 @@ export function TasksActivityLog(props: TasksActivityLogProps) { onChange(set(notification.subscribers, ['subscribers'])) - operation.create(nextComment).then(() => { - // eslint-disable-next-line camelcase - telemetry.log(TaskCommentAdded, {is_reply: false}) - }) + operation.create(nextComment) }, - [handleGetNotificationValue, onChange, operation, telemetry], + [operation, handleGetNotificationValue, onChange], ) const handleCommentReply = useCallback( @@ -134,25 +129,20 @@ export function TasksActivityLog(props: TasksActivityLogProps) { onChange(set(notification.subscribers, ['subscribers'])) - operation - .create({ - id: commentId, - type: 'task', - message: nextComment.message, - parentCommentId: nextComment.parentCommentId, - reactions: EMPTY_ARRAY, - status: 'open', - threadId: nextComment.threadId, - context: { - notification, - }, - }) - .then(() => { - // eslint-disable-next-line camelcase - telemetry.log(TaskCommentAdded, {is_reply: true}) - }) + operation.create({ + id: commentId, + type: 'task', + message: nextComment.message, + parentCommentId: nextComment.parentCommentId, + reactions: EMPTY_ARRAY, + status: 'open', + threadId: nextComment.threadId, + context: { + notification, + }, + }) }, - [handleGetNotificationValue, onChange, operation, telemetry], + [operation, handleGetNotificationValue, onChange], ) const handleCommentCreateRetry = useCallback( @@ -166,25 +156,20 @@ export function TasksActivityLog(props: TasksActivityLogProps) { onChange(set(notification.subscribers, ['subscribers'])) - operation - .create({ - type: 'task', - id: comment._id, - message: comment.message, - parentCommentId: comment.parentCommentId, - reactions: comment.reactions || EMPTY_ARRAY, - status: comment.status, - threadId: comment.threadId, - context: { - notification, - }, - }) - .then(() => { - // eslint-disable-next-line camelcase - telemetry.log(TaskCommentAdded, {is_reply: !!comment.parentCommentId}) - }) + operation.create({ + type: 'task', + id: comment._id, + message: comment.message, + parentCommentId: comment.parentCommentId, + reactions: comment.reactions || EMPTY_ARRAY, + status: comment.status, + threadId: comment.threadId, + context: { + notification, + }, + }) }, - [getComment, handleGetNotificationValue, onChange, operation, telemetry], + [getComment, operation, handleGetNotificationValue, onChange], ) const handleCommentReact = useCallback(