Skip to content

Commit

Permalink
fix(tasks): title case for events and reduce number of events
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Apr 8, 2024
1 parent 73fcbed commit 3c1a870
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
21 changes: 8 additions & 13 deletions packages/sanity/src/tasks/__telemetry__/tasks.telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,38 @@ export const TaskStatusChanged = defineEvent<{
})

// A comment is added in a task
export const TaskCommentAdded = defineEvent({
name: 'Task comment added',
export const TaskCommentAdded = defineEvent<{
is_reply: boolean
}>({
name: 'Task Comment Added',
version: 1,
description: 'A comment was added in a task',
})

// A reply is added
export const TaskCommentReplyAdded = defineEvent({
name: 'Task comment reply added',
version: 1,
description: 'A reply was added to a comment in a task',
})

// A task is duplicated
export const TaskDuplicated = defineEvent({
name: 'Task duplicated',
name: 'Task Duplicated',
version: 1,
description: 'A task is duplicated',
})

// A task is removed
export const TaskRemoved = defineEvent({
name: 'Task removed',
name: 'Task Removed',
version: 1,
description: 'A task is removed',
})

// The link to a task is copied
export const TaskLinkCopied = defineEvent({
name: 'Task link copied',
name: 'Task Link Copied',
version: 1,
description: 'The link to a task is copied',
})

// User visited the studio through a link with a task
export const TaskLinkOpened = defineEvent({
name: 'Task link opened',
name: 'Task Link Opened',
version: 1,
description: 'User visited the studio through a link with a task',
})
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
type CommentUpdatePayload,
useComments,
} from '../../../../../structure/comments'
import {TaskCommentAdded, TaskCommentReplyAdded} from '../../../../__telemetry__/tasks.telemetry'
import {TaskCommentAdded} from '../../../../__telemetry__/tasks.telemetry'
import {tasksLocaleNamespace} from '../../../../i18n'
import {type TaskDocument} from '../../types'
import {getMentionedUsers} from '../form/utils'
Expand Down Expand Up @@ -119,7 +119,8 @@ export function TasksActivityLog(props: TasksActivityLogProps) {
onChange(set(notification.subscribers, ['subscribers']))

operation.create(nextComment).then(() => {
telemetry.log(TaskCommentAdded)
// eslint-disable-next-line camelcase
telemetry.log(TaskCommentAdded, {is_reply: false})
})
},
[handleGetNotificationValue, onChange, operation, telemetry],
Expand Down Expand Up @@ -147,7 +148,8 @@ export function TasksActivityLog(props: TasksActivityLogProps) {
},
})
.then(() => {
telemetry.log(TaskCommentReplyAdded)
// eslint-disable-next-line camelcase
telemetry.log(TaskCommentAdded, {is_reply: true})
})
},
[handleGetNotificationValue, onChange, operation, telemetry],
Expand Down Expand Up @@ -178,7 +180,8 @@ export function TasksActivityLog(props: TasksActivityLogProps) {
},
})
.then(() => {
telemetry.log(TaskCommentReplyAdded)
// eslint-disable-next-line camelcase
telemetry.log(TaskCommentAdded, {is_reply: !!comment.parentCommentId})
})
},
[getComment, handleGetNotificationValue, onChange, operation, telemetry],
Expand Down

0 comments on commit 3c1a870

Please sign in to comment.