Skip to content

Commit

Permalink
[FIX] Fixed a bug prevent thread on proposed change overview (#4226)
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalabbad authored Aug 30, 2024
1 parent 766d266 commit 1f32a2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
28 changes: 2 additions & 26 deletions frontend/app/src/components/conversations/thread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import { Checkbox } from "@/components/inputs/checkbox";
import ModalConfirm from "@/components/modals/modal-confirm";
import { ALERT_TYPES, Alert } from "@/components/ui/alert";
import { Tooltip } from "@/components/ui/tooltip";
import {
DIFF_TABS,
PROPOSED_CHANGES_ARTIFACT_THREAD_OBJECT,
PROPOSED_CHANGES_CHANGE_THREAD_OBJECT,
PROPOSED_CHANGES_OBJECT_THREAD_OBJECT,
PROPOSED_CHANGES_THREAD_COMMENT_OBJECT,
} from "@/config/constants";
import { PROPOSED_CHANGES_THREAD_COMMENT_OBJECT } from "@/config/constants";
import graphqlClient from "@/graphql/graphqlClientApollo";
import { createObject } from "@/graphql/mutations/objects/createObject";
import { updateObjectWithId } from "@/graphql/mutations/objects/updateObjectWithId";
Expand All @@ -27,8 +21,6 @@ import { useState } from "react";
import { toast } from "react-toastify";
import { AddComment } from "./add-comment";
import { Comment } from "./comment";
import { StringParam, useQueryParam } from "use-query-params";
import { QSP } from "@/config/qsp";
import { Card } from "@/components/ui/card";

type tThread = {
Expand All @@ -49,7 +41,6 @@ export const Thread = (props: tThread) => {

const auth = useAuth();

const [qspTab] = useQueryParam(QSP.PROPOSED_CHANGES_TAB, StringParam);
const branch = useAtomValue(currentBranchAtom);
const date = useAtomValue(datetimeAtom);
const [isLoading, setIsLoading] = useState(false);
Expand Down Expand Up @@ -111,21 +102,6 @@ export const Thread = (props: tThread) => {
}
};

const getMutation = () => {
// for artifacts view
if (qspTab === DIFF_TABS.ARTIFACTS) {
return PROPOSED_CHANGES_ARTIFACT_THREAD_OBJECT;
}

// for conversations view
if (displayContext) {
return PROPOSED_CHANGES_CHANGE_THREAD_OBJECT;
}

// for object views
return PROPOSED_CHANGES_OBJECT_THREAD_OBJECT;
};

const handleResolve = async () => {
if (!thread.id) {
return;
Expand All @@ -139,7 +115,7 @@ export const Thread = (props: tThread) => {
}

const mutationString = updateObjectWithId({
kind: getMutation(),
kind: thread.__typename,
data: stringifyWithoutQuotes({
id: thread.id,
resolved: {
Expand Down
4 changes: 0 additions & 4 deletions frontend/app/src/config/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export const PROPOSED_CHANGES_ARTIFACT_THREAD_OBJECT = "CoreArtifactThread";

export const ARTIFACT_OBJECT = "CoreArtifact";

export const INFRAHUB_TASK = "InfrahubTask";

export const GRAPHQL_QUERY_OBJECT = "CoreGraphQLQuery";

export const PROPOSED_CHANGES_THREAD_COMMENT_OBJECT = "CoreThreadComment";
Expand All @@ -54,8 +52,6 @@ export const SCHEMA_ENUM_ADD = "SchemaEnumAdd";

export const SCHEMA_ENUM_REMOVE = "SchemaEnumRemove";

export const GROUP_OBJECT = "CoreGroup";

export const NUMBER_POOL_OBJECT = "CoreNumberPool";

export const TASK_OBJECT = "InfrahubTask";
Expand Down

0 comments on commit 1f32a2a

Please sign in to comment.