forked from github/plane
fix: bug and auth fixes (#1224)
* fix: sign in and invitation page fixes * fix: project and workspace services track event fix * fix: user onboarding complete track event fix * fix: issue track event fix * fix: partial property , issue comment and mark as done issue track event fix * fix: bulk delete , move to cycle or module and issue label track event fix * fix: state , cycle and module track event fix * fix: pages and block track event fix * fix: integration , estimate , importer , analytics and gpt track event fix * fix: view track event fix * fix: build fix * fix: build fix
This commit is contained in:
committed by
GitHub
parent
c127353281
commit
6f2a38ad66
@@ -18,6 +18,7 @@ import {
|
||||
IProjectMember,
|
||||
TIssueGroupByOptions,
|
||||
TIssueOrderByOptions,
|
||||
ICurrentUserResponse,
|
||||
} from "types";
|
||||
// fetch-keys
|
||||
import {
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
USER_PROJECT_VIEW,
|
||||
VIEW_DETAILS,
|
||||
} from "constants/fetch-keys";
|
||||
import useUserAuth from "hooks/use-user-auth";
|
||||
|
||||
export const issueViewContext = createContext<ContextType>({} as ContextType);
|
||||
|
||||
@@ -212,33 +214,54 @@ const saveCycleFilters = async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
cycleId: string,
|
||||
state: any
|
||||
state: any,
|
||||
user: ICurrentUserResponse | undefined
|
||||
) => {
|
||||
await cyclesService.patchCycle(workspaceSlug, projectId, cycleId, {
|
||||
...state,
|
||||
});
|
||||
await cyclesService.patchCycle(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
cycleId,
|
||||
{
|
||||
...state,
|
||||
},
|
||||
user
|
||||
);
|
||||
};
|
||||
|
||||
const saveModuleFilters = async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
moduleId: string,
|
||||
state: any
|
||||
state: any,
|
||||
user: ICurrentUserResponse | undefined
|
||||
) => {
|
||||
await modulesService.patchModule(workspaceSlug, projectId, moduleId, {
|
||||
...state,
|
||||
});
|
||||
await modulesService.patchModule(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
moduleId,
|
||||
{
|
||||
...state,
|
||||
},
|
||||
user
|
||||
);
|
||||
};
|
||||
|
||||
const saveViewFilters = async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
viewId: string,
|
||||
state: any
|
||||
state: any,
|
||||
user: ICurrentUserResponse | undefined
|
||||
) => {
|
||||
await viewsService.patchView(workspaceSlug, projectId, viewId, {
|
||||
...state,
|
||||
});
|
||||
await viewsService.patchView(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
viewId,
|
||||
{
|
||||
...state,
|
||||
},
|
||||
user
|
||||
);
|
||||
};
|
||||
|
||||
const setNewDefault = async (workspaceSlug: string, projectId: string, state: any) => {
|
||||
@@ -267,6 +290,8 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query;
|
||||
|
||||
const { user } = useUserAuth();
|
||||
|
||||
const { data: myViewProps, mutate: mutateMyViewProps } = useSWR(
|
||||
workspaceSlug && projectId ? USER_PROJECT_VIEW(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
@@ -505,14 +530,20 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
|
||||
};
|
||||
}, false);
|
||||
|
||||
saveCycleFilters(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), {
|
||||
view_props: {
|
||||
filters: {
|
||||
...state.filters,
|
||||
...property,
|
||||
saveCycleFilters(
|
||||
workspaceSlug.toString(),
|
||||
projectId.toString(),
|
||||
cycleId.toString(),
|
||||
{
|
||||
view_props: {
|
||||
filters: {
|
||||
...state.filters,
|
||||
...property,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
user
|
||||
);
|
||||
} else if (moduleId) {
|
||||
mutateModuleDetails((prevData: any) => {
|
||||
if (!prevData) return prevData;
|
||||
@@ -528,14 +559,20 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
|
||||
};
|
||||
}, false);
|
||||
|
||||
saveModuleFilters(workspaceSlug.toString(), projectId.toString(), moduleId.toString(), {
|
||||
view_props: {
|
||||
filters: {
|
||||
...state.filters,
|
||||
...property,
|
||||
saveModuleFilters(
|
||||
workspaceSlug.toString(),
|
||||
projectId.toString(),
|
||||
moduleId.toString(),
|
||||
{
|
||||
view_props: {
|
||||
filters: {
|
||||
...state.filters,
|
||||
...property,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
user
|
||||
);
|
||||
} else if (viewId) {
|
||||
mutateViewDetails((prevData: any) => {
|
||||
if (!prevData) return prevData;
|
||||
@@ -548,12 +585,18 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
|
||||
};
|
||||
}, false);
|
||||
if (saveToServer)
|
||||
saveViewFilters(workspaceSlug as string, projectId as string, viewId as string, {
|
||||
query_data: {
|
||||
...state.filters,
|
||||
...property,
|
||||
saveViewFilters(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
viewId as string,
|
||||
{
|
||||
query_data: {
|
||||
...state.filters,
|
||||
...property,
|
||||
},
|
||||
},
|
||||
});
|
||||
user
|
||||
);
|
||||
} else {
|
||||
mutateMyViewProps((prevData) => {
|
||||
if (!prevData) return prevData;
|
||||
|
||||
Reference in New Issue
Block a user