[WIKI-556] fix : invert tracking logic #7668
This commit is contained in:
parent
e144ce8cf2
commit
7a43137620
3 changed files with 7 additions and 13 deletions
|
|
@ -198,7 +198,7 @@ class PageViewSet(BaseViewSet):
|
||||||
def retrieve(self, request, slug, project_id, pk=None):
|
def retrieve(self, request, slug, project_id, pk=None):
|
||||||
page = self.get_queryset().filter(pk=pk).first()
|
page = self.get_queryset().filter(pk=pk).first()
|
||||||
project = Project.objects.get(pk=project_id)
|
project = Project.objects.get(pk=project_id)
|
||||||
track_visit = request.query_params.get("track_visit", "false").lower() == "true"
|
track_visit = request.query_params.get("track_visit", "true").lower() == "true"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if the role is guest and guest_view_all_features is false and owned by is not
|
if the role is guest and guest_view_all_features is false and owned by is not
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,7 @@ const PageDetailsPage = observer(() => {
|
||||||
const { error: pageDetailsError } = useSWR(
|
const { error: pageDetailsError } = useSWR(
|
||||||
workspaceSlug && projectId && pageId ? `PAGE_DETAILS_${pageId}` : null,
|
workspaceSlug && projectId && pageId ? `PAGE_DETAILS_${pageId}` : null,
|
||||||
workspaceSlug && projectId && pageId
|
workspaceSlug && projectId && pageId
|
||||||
? () =>
|
? () => fetchPageDetails(workspaceSlug?.toString(), projectId?.toString(), pageId.toString())
|
||||||
fetchPageDetails(workspaceSlug?.toString(), projectId?.toString(), pageId.toString(), {
|
|
||||||
trackVisit: true,
|
|
||||||
})
|
|
||||||
: null,
|
: null,
|
||||||
{
|
{
|
||||||
revalidateIfStale: true,
|
revalidateIfStale: true,
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export interface IProjectPageStore {
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
pageId: string,
|
pageId: string,
|
||||||
{ trackVisit }: { trackVisit: boolean }
|
options?: { trackVisit?: boolean }
|
||||||
) => Promise<TPage | undefined>;
|
) => Promise<TPage | undefined>;
|
||||||
createPage: (pageData: Partial<TPage>) => Promise<TPage | undefined>;
|
createPage: (pageData: Partial<TPage>) => Promise<TPage | undefined>;
|
||||||
removePage: (pageId: string) => Promise<void>;
|
removePage: (pageId: string) => Promise<void>;
|
||||||
|
|
@ -244,12 +244,9 @@ export class ProjectPageStore implements IProjectPageStore {
|
||||||
* @description fetch the details of a page
|
* @description fetch the details of a page
|
||||||
* @param {string} pageId
|
* @param {string} pageId
|
||||||
*/
|
*/
|
||||||
fetchPageDetails = async (
|
fetchPageDetails = async (...args: Parameters<IProjectPageStore["fetchPageDetails"]>) => {
|
||||||
workspaceSlug: string,
|
const [workspaceSlug, projectId, pageId, options] = args;
|
||||||
projectId: string,
|
const { trackVisit } = options || {};
|
||||||
pageId: string,
|
|
||||||
{ trackVisit }: { trackVisit: boolean }
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
if (!workspaceSlug || !projectId || !pageId) return undefined;
|
if (!workspaceSlug || !projectId || !pageId) return undefined;
|
||||||
|
|
||||||
|
|
@ -259,7 +256,7 @@ export class ProjectPageStore implements IProjectPageStore {
|
||||||
this.error = undefined;
|
this.error = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
const page = await this.service.fetchById(workspaceSlug, projectId, pageId, trackVisit);
|
const page = await this.service.fetchById(workspaceSlug, projectId, pageId, trackVisit ?? true);
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
if (page?.id) {
|
if (page?.id) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue