Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): comments module multiregion support #3493

Merged
merged 14 commits into from
Nov 19, 2024
13 changes: 10 additions & 3 deletions packages/frontend-2/components/settings/workspaces/Regions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,18 @@ const props = defineProps<{
workspaceId: string
}>()

const pageFetchPolicy = usePageQueryStandardFetchPolicy()
const isLoading = useMutationLoading()
const setDefaultWorkspaceRegion = useSetDefaultWorkspaceRegion()
const { result } = useQuery(settingsWorkspaceRegionsQuery, () => ({
workspaceId: props.workspaceId
}))
const { result } = useQuery(
settingsWorkspaceRegionsQuery,
() => ({
workspaceId: props.workspaceId
}),
() => ({
fetchPolicy: pageFetchPolicy.value
})
)

const defaultRegion = ref<SettingsWorkspacesRegionsSelect_ServerRegionItemFragment>()
const availableRegions = computed(() => result.value?.workspace.availableRegions || [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ const isThreadResourceLoaded = computed(() => {
})

const toggleCommentResolvedStatus = async () => {
await archiveComment(props.modelValue.id, !props.modelValue.archived)
await archiveComment({
commentId: props.modelValue.id,
projectId: projectId.value,
archived: !props.modelValue.archived
})
mp.track('Comment Action', {
type: 'action',
name: 'archive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<script setup lang="ts">
import { PaperAirplaneIcon, PaperClipIcon } from '@heroicons/vue/24/solid'
import type { Nullable } from '@speckle/shared'
import { useInjectedViewerState } from '~/lib/viewer/composables/setup'
import { useMixpanel } from '~~/lib/core/composables/mp'
import { useIsTypingUpdateEmitter } from '~~/lib/viewer/composables/commentBubbles'
import type { CommentBubbleModel } from '~~/lib/viewer/composables/commentBubbles'
Expand All @@ -54,6 +55,7 @@ const emit = defineEmits<{

const createReply = useSubmitReply()
const { onKeyDownHandler, updateIsTyping } = useIsTypingUpdateEmitter()
const { projectId } = useInjectedViewerState()

const loading = ref(false)
const editor = ref(null as Nullable<{ openFilePicker: () => void }>)
Expand All @@ -75,7 +77,8 @@ const onSubmit = async () => {
loading.value = true
await createReply({
content,
threadId: threadId.value
threadId: threadId.value,
projectId: projectId.value
})
updateIsTyping(false)

Expand Down
24 changes: 14 additions & 10 deletions packages/frontend-2/components/viewer/comments/ListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ const {
threads: { openThread }
} = useInjectedViewerInterfaceState()
const { open: openThreadRaw } = useThreadUtilities()
const { activeUser } = useActiveUser()
const archiveComment = useArchiveComment()
const { triggerNotification } = useGlobalToast()
const {
projectId,
resources: {
response: { project }
}
} = useInjectedViewerState()

const mp = useMixpanel()
const open = (id: string) => {
Expand Down Expand Up @@ -125,15 +134,6 @@ const threadAuthors = computed(() => {
return authors
})

const { activeUser } = useActiveUser()
const archiveComment = useArchiveComment()
const { triggerNotification } = useGlobalToast()
const {
resources: {
response: { project }
}
} = useInjectedViewerState()

const canArchiveOrUnarchive = computed(
() =>
activeUser.value &&
Expand All @@ -142,7 +142,11 @@ const canArchiveOrUnarchive = computed(
)

const toggleCommentResolvedStatus = async () => {
await archiveComment(props.thread.id, !props.thread.archived)
await archiveComment({
commentId: props.thread.id,
projectId: projectId.value,
archived: !props.thread.archived
})
mp.track('Comment Action', {
type: 'action',
name: 'archive',
Expand Down
9 changes: 5 additions & 4 deletions packages/frontend-2/lib/common/generated/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-
* 3. It does not support dead code elimination, so it will add unused operations.
*
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
"\n fragment AuthLoginWithEmailBlock_PendingWorkspaceCollaborator on PendingWorkspaceCollaborator {\n id\n email\n user {\n id\n }\n }\n": types.AuthLoginWithEmailBlock_PendingWorkspaceCollaboratorFragmentDoc,
Expand Down Expand Up @@ -310,10 +311,10 @@ const documents = {
"\n fragment ViewerCommentThread on Comment {\n ...ViewerCommentsListItem\n ...ViewerCommentBubblesData\n ...ViewerCommentsReplyItem\n }\n": types.ViewerCommentThreadFragmentDoc,
"\n fragment ViewerCommentsReplyItem on Comment {\n id\n archived\n rawText\n text {\n doc\n }\n author {\n ...LimitedUserAvatar\n }\n createdAt\n ...ThreadCommentAttachment\n }\n": types.ViewerCommentsReplyItemFragmentDoc,
"\n mutation BroadcastViewerUserActivity(\n $projectId: String!\n $resourceIdString: String!\n $message: ViewerUserActivityMessageInput!\n ) {\n broadcastViewerUserActivity(\n projectId: $projectId\n resourceIdString: $resourceIdString\n message: $message\n )\n }\n": types.BroadcastViewerUserActivityDocument,
"\n mutation MarkCommentViewed($threadId: String!) {\n commentMutations {\n markViewed(commentId: $threadId)\n }\n }\n": types.MarkCommentViewedDocument,
"\n mutation MarkCommentViewed($input: MarkCommentViewedInput!) {\n commentMutations {\n markViewed(input: $input)\n }\n }\n": types.MarkCommentViewedDocument,
"\n mutation CreateCommentThread($input: CreateCommentInput!) {\n commentMutations {\n create(input: $input) {\n ...ViewerCommentThread\n }\n }\n }\n": types.CreateCommentThreadDocument,
"\n mutation CreateCommentReply($input: CreateCommentReplyInput!) {\n commentMutations {\n reply(input: $input) {\n ...ViewerCommentsReplyItem\n }\n }\n }\n": types.CreateCommentReplyDocument,
"\n mutation ArchiveComment($commentId: String!, $archived: Boolean) {\n commentMutations {\n archive(commentId: $commentId, archived: $archived)\n }\n }\n": types.ArchiveCommentDocument,
"\n mutation ArchiveComment($input: ArchiveCommentInput!) {\n commentMutations {\n archive(input: $input)\n }\n }\n": types.ArchiveCommentDocument,
"\n query ProjectViewerResources($projectId: String!, $resourceUrlString: String!) {\n project(id: $projectId) {\n id\n viewerResources(resourceIdString: $resourceUrlString) {\n identifier\n items {\n modelId\n versionId\n objectId\n }\n }\n }\n }\n": types.ProjectViewerResourcesDocument,
"\n query ViewerLoadedResources(\n $projectId: String!\n $modelIds: [String!]!\n $versionIds: [String!]\n ) {\n project(id: $projectId) {\n id\n role\n allowPublicComments\n models(filter: { ids: $modelIds }) {\n totalCount\n items {\n id\n name\n updatedAt\n loadedVersion: versions(\n filter: { priorityIds: $versionIds, priorityIdsOnly: true }\n ) {\n items {\n ...ViewerModelVersionCardItem\n automationsStatus {\n id\n automationRuns {\n ...AutomateViewerPanel_AutomateRun\n }\n }\n }\n }\n versions(limit: 5) {\n totalCount\n cursor\n items {\n ...ViewerModelVersionCardItem\n }\n }\n }\n }\n ...ProjectPageLatestItemsModels\n ...ModelPageProject\n ...HeaderNavShare_Project\n }\n }\n": types.ViewerLoadedResourcesDocument,
"\n query ViewerModelVersions(\n $projectId: String!\n $modelId: String!\n $versionsCursor: String\n ) {\n project(id: $projectId) {\n id\n role\n model(id: $modelId) {\n id\n versions(cursor: $versionsCursor, limit: 5) {\n totalCount\n cursor\n items {\n ...ViewerModelVersionCardItem\n }\n }\n }\n }\n }\n": types.ViewerModelVersionsDocument,
Expand Down Expand Up @@ -1556,7 +1557,7 @@ export function graphql(source: "\n mutation BroadcastViewerUserActivity(\n
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n mutation MarkCommentViewed($threadId: String!) {\n commentMutations {\n markViewed(commentId: $threadId)\n }\n }\n"): (typeof documents)["\n mutation MarkCommentViewed($threadId: String!) {\n commentMutations {\n markViewed(commentId: $threadId)\n }\n }\n"];
export function graphql(source: "\n mutation MarkCommentViewed($input: MarkCommentViewedInput!) {\n commentMutations {\n markViewed(input: $input)\n }\n }\n"): (typeof documents)["\n mutation MarkCommentViewed($input: MarkCommentViewedInput!) {\n commentMutations {\n markViewed(input: $input)\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand All @@ -1568,7 +1569,7 @@ export function graphql(source: "\n mutation CreateCommentReply($input: CreateC
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n mutation ArchiveComment($commentId: String!, $archived: Boolean) {\n commentMutations {\n archive(commentId: $commentId, archived: $archived)\n }\n }\n"): (typeof documents)["\n mutation ArchiveComment($commentId: String!, $archived: Boolean) {\n commentMutations {\n archive(commentId: $commentId, archived: $archived)\n }\n }\n"];
export function graphql(source: "\n mutation ArchiveComment($input: ArchiveCommentInput!) {\n commentMutations {\n archive(input: $input)\n }\n }\n"): (typeof documents)["\n mutation ArchiveComment($input: ArchiveCommentInput!) {\n commentMutations {\n archive(input: $input)\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading