From 96b1d05b2699021dca14dae047a1285e11965502 Mon Sep 17 00:00:00 2001 From: blushi Date: Tue, 3 Mar 2026 16:35:28 +0100 Subject: [PATCH 1/3] chore: update role author desc --- .../ProjectCollaborators/ProjectCollaborators.constants.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-marketplace/src/components/organisms/ProjectCollaborators/ProjectCollaborators.constants.tsx b/web-marketplace/src/components/organisms/ProjectCollaborators/ProjectCollaborators.constants.tsx index fc46dcf7b8..89149c5b8a 100644 --- a/web-marketplace/src/components/organisms/ProjectCollaborators/ProjectCollaborators.constants.tsx +++ b/web-marketplace/src/components/organisms/ProjectCollaborators/ProjectCollaborators.constants.tsx @@ -9,7 +9,7 @@ export const ROLE_EDITOR_LABEL = msg`Editor`; export const ROLE_EDITOR_DESCRIPTION = msg`Can edit all project page info and posts. Cannot manage users or credits.`; export const ROLE_AUTHOR_LABEL = msg`Author`; -export const ROLE_AUTHOR_DESCRIPTION = msg`Can create, edit, and delete data posts.`; +export const ROLE_AUTHOR_DESCRIPTION = msg`Can create, edit, and delete their own data posts. Cannot see private post data.`; export const ROLE_VIEWER_LABEL = msg`Viewer`; export const ROLE_VIEWER_DESCRIPTION = msg`Can view all posts, documents, and location data, even when private.`; From f0df171af4b90147ded4e3c15f8c3e59cf8c6ad2 Mon Sep 17 00:00:00 2001 From: blushi Date: Mon, 9 Mar 2026 16:14:01 +0100 Subject: [PATCH 2/3] feat: update author role permissions --- .../organisms/PostFiles/PostFiles.Public.tsx | 9 +- .../organisms/PostFiles/PostFiles.stories.tsx | 7 +- .../organisms/PostFiles/PostFiles.tsx | 14 +-- .../ProjectDetails.DataStream.Post.tsx | 37 +++++-- .../ProjectDetails.DataStream.tsx | 10 +- .../ProjectDetails/ProjectDetails.tsx | 14 +-- .../ProjectFormAccessTemplate.utils.test.ts | 66 ++++++++++--- .../ProjectFormAccessTemplate.utils.ts | 67 +++++++++++-- .../useMigrateProjects.utils.test.ts | 1 - .../Dashboard/MyProjects/ManageProject.tsx | 11 ++- .../src/legacy-pages/Post/Post.Header.tsx | 10 +- .../src/legacy-pages/Post/Post.tsx | 97 +++++++++++++++---- 12 files changed, 260 insertions(+), 83 deletions(-) diff --git a/web-components/src/components/organisms/PostFiles/PostFiles.Public.tsx b/web-components/src/components/organisms/PostFiles/PostFiles.Public.tsx index 93e0af4034..9572b1eb35 100644 --- a/web-components/src/components/organisms/PostFiles/PostFiles.Public.tsx +++ b/web-components/src/components/organisms/PostFiles/PostFiles.Public.tsx @@ -46,7 +46,10 @@ const Popup = dynamic(() => import('react-map-gl').then(mod => mod.Popup), { ssr: false, }); -type Props = Pick & { +type Props = Pick< + PostFilesProps, + 'files' | 'mapboxToken' | 'canViewPrivatePost' +> & { privateFiles: boolean; privateLocations: boolean; filesPreviews: FilesPreviews; @@ -58,7 +61,7 @@ type Props = Pick & { const PostFilesPublic = ({ files, mapboxToken, - isAdmin, + canViewPrivatePost, privateFiles, privateLocations, filesPreviews, @@ -291,7 +294,7 @@ const PostFilesPublic = ({ canDownloadFiles={canDownloadFiles} /> )} - {isAdmin && (privateLocations || privateFiles) && ( + {canViewPrivatePost && (privateLocations || privateFiles) && ( } diff --git a/web-components/src/components/organisms/PostFiles/PostFiles.stories.tsx b/web-components/src/components/organisms/PostFiles/PostFiles.stories.tsx index fb204d8cf1..3edf85201d 100644 --- a/web-components/src/components/organisms/PostFiles/PostFiles.stories.tsx +++ b/web-components/src/components/organisms/PostFiles/PostFiles.stories.tsx @@ -21,6 +21,7 @@ Public.args = { mapboxToken: import.meta.env.STORYBOOK_MAPBOX_TOKEN, files, photoCredit: 'Photo credit', + canViewPrivatePost: false, readMoreText, }; @@ -32,6 +33,7 @@ PrivateLocations.args = { privacyType: 'private_locations', mapboxToken: import.meta.env.STORYBOOK_MAPBOX_TOKEN, files: [], + canViewPrivatePost: false, readMoreText, }; @@ -43,6 +45,7 @@ PrivateFiles.args = { privacyType: 'private_files', mapboxToken: import.meta.env.STORYBOOK_MAPBOX_TOKEN, files: [], + canViewPrivatePost: false, readMoreText, }; @@ -54,7 +57,7 @@ PrivateLocationsAsAdmin.args = { privacyType: 'private_locations', mapboxToken: import.meta.env.STORYBOOK_MAPBOX_TOKEN, files: [], - isAdmin: true, + canViewPrivatePost: true, readMoreText, }; @@ -66,6 +69,6 @@ PrivateFilesAsAdmin.args = { privacyType: 'private_files', mapboxToken: import.meta.env.STORYBOOK_MAPBOX_TOKEN, files: [], - isAdmin: true, + canViewPrivatePost: true, readMoreText, }; diff --git a/web-components/src/components/organisms/PostFiles/PostFiles.tsx b/web-components/src/components/organisms/PostFiles/PostFiles.tsx index a8716e9d36..cb88788995 100644 --- a/web-components/src/components/organisms/PostFiles/PostFiles.tsx +++ b/web-components/src/components/organisms/PostFiles/PostFiles.tsx @@ -23,7 +23,7 @@ export type PostFilesProps = { privacyType: PostPrivacyType; files: Array; mapboxToken?: string; - isAdmin: boolean; + canViewPrivatePost: boolean; hasToken?: boolean; photoCredit: string; adminPrivateLabel: string; @@ -37,7 +37,7 @@ const PostFiles = ({ privacyType, files, mapboxToken, - isAdmin = false, + canViewPrivatePost, hasToken = false, photoCredit, adminPrivateLabel, @@ -73,15 +73,15 @@ const PostFiles = ({
- {(isPublic || isAdmin || hasToken) && ( + {(isPublic || hasToken) && ( )} - {!isAdmin && !hasToken && privateLocations && ( + {!canViewPrivatePost && !hasToken && privateLocations && ( )} - {!isAdmin && !hasToken && privateFiles && ( + {!canViewPrivatePost && !hasToken && privateFiles && ( )}
diff --git a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.Post.tsx b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.Post.tsx index 27eb54ec1a..6036742f29 100644 --- a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.Post.tsx +++ b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.Post.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { ApolloClient, NormalizedCacheObject, @@ -49,15 +49,21 @@ import copyTextToClipboard from 'web-components/src/utils/copy'; import { bannerTextAtom } from 'lib/atoms/banner.atoms'; import { selectedLanguageAtom } from 'lib/atoms/languageSwitcher.atoms'; +import { useAuth } from 'lib/auth/auth'; import { COPY_SUCCESS } from 'lib/constants/shared.constants'; import { LINK_PREFIX } from 'lib/env'; import { Post } from 'lib/queries/react-query/registry-server/getPostQuery/getPostQuery.types'; import { getAccountByIdQuery } from 'lib/queries/react-query/registry-server/graphql/getAccountByIdQuery/getAccountByIdQuery'; import { Link } from 'components/atoms'; +import { ProjectRole } from 'components/organisms/BaseMembersTable/BaseMembersTable.types'; import { DeletePostWarningModal } from 'components/organisms/DeletePostWarningModal/DeletePostWarningModal'; import { PostFormSchemaType } from 'components/organisms/PostForm/PostForm.schema'; +import { + getCanSeeOrManagePost, + getCanViewPrivatePost, +} from '../ProjectFormTemplate/ProjectFormAccessTemplate.utils'; import { FILES_ARE_PRIVATE, LOCATIONS_ARE_PRIVATE, @@ -74,8 +80,7 @@ type Props = { setDraftPost: UseStateSetter | undefined>; projectLocation: GeocodeFeature; openCreatePostModal: () => void; - canManagePost: boolean; - canViewPost: boolean; + role?: ProjectRole; }; export const DataStreamPost = ({ offChainProjectId, @@ -87,8 +92,7 @@ export const DataStreamPost = ({ setDraftPost, projectLocation, openCreatePostModal, - canManagePost, - canViewPost, + role, }: Props) => { const { _ } = useLingui(); const [selectedLanguage] = useAtom(selectedLanguageAtom); @@ -104,11 +108,13 @@ export const DataStreamPost = ({ iri, offChainProjectId, }); + const { activeAccountId: currentAccountId } = useAuth(); + const creatorAccountId = post.creatorAccountId; const { data: creatorAccountData } = useQuery( getAccountByIdQuery({ client: graphqlClient, - id: post.creatorAccountId, + id: creatorAccountId, enabled: !!graphqlClient, languageCode: selectedLanguage, }), @@ -116,6 +122,25 @@ export const DataStreamPost = ({ const creatorAccount = creatorAccountData?.accountById; const creatorIsAdmin = creatorAccount?.id === adminAccountId; + const canManagePost = useMemo( + () => + getCanSeeOrManagePost({ + role, + creatorAccountId, + currentAccountId, + }), + [role, creatorAccountId, currentAccountId], + ); + const canViewPost = useMemo( + () => + getCanViewPrivatePost({ + role, + creatorAccountId, + currentAccountId, + }), + [role, creatorAccountId, currentAccountId], + ); + const { events } = useAttestEvents({ iri, createdAt, diff --git a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx index 42bf97c5db..047ad40d86 100644 --- a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx +++ b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx @@ -29,6 +29,7 @@ import { DATA_STREAM_LIMIT } from 'lib/queries/react-query/registry-server/getPo import { PostsQueryResponse } from 'lib/queries/react-query/registry-server/getPostsQuery/getPostsQuery.types'; import { getPostsQueryKey } from 'lib/queries/react-query/registry-server/getPostsQuery/getPostsQuery.utils'; +import { ProjectRole } from 'components/organisms/BaseMembersTable/BaseMembersTable.types'; import { PostFormSchemaType } from 'components/organisms/PostForm/PostForm.schema'; import { useHash } from 'hooks/useHash'; @@ -48,8 +49,7 @@ type Props = { projectLocation?: GeocodeFeature; openCreatePostModal: () => void; setDraftPost: UseStateSetter | undefined>; - canManagePost: boolean; - canViewPost: boolean; + role?: ProjectRole; }; export const DataStream = ({ @@ -60,8 +60,7 @@ export const DataStream = ({ projectLocation, openCreatePostModal, setDraftPost, - canManagePost, - canViewPost, + role, }: Props) => { const { _ } = useLingui(); const [selectedLanguage] = useAtom(selectedLanguageAtom); @@ -157,14 +156,13 @@ export const DataStream = ({ post={post} index={i} postsLength={posts.length} - canManagePost={canManagePost} adminAccountId={adminAccountId} offChainProjectId={offChainProjectId} adminAddr={adminAddr} setDraftPost={setDraftPost} projectLocation={projectLocation} openCreatePostModal={openCreatePostModal} - canViewPost={canViewPost} + role={role} /> ))} diff --git a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx index 15954b35c5..791fe4641f 100644 --- a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx +++ b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx @@ -51,9 +51,10 @@ import { ProjectStorySection } from 'components/organisms/ProjectStorySection/Pr import { SellOrdersActionsBar } from 'components/organisms/SellOrdersActionsBar/SellOrdersActionsBar'; import { AVG_PRICE_TOOLTIP_PROJECT } from 'components/organisms/SellOrdersActionsBar/SellOrdersActionsBar.constants'; import { + getCanCreatePost, getCanEditProject, - getCanManagePost, - getCanViewPost, + getCanSeeOrManagePost, + getCanViewPrivatePost, } from 'components/templates/ProjectFormTemplate/ProjectFormAccessTemplate.utils'; import { useFetchPaginatedBatches } from 'hooks/batches/useFetchPaginatedBatches'; import { useOnBuyButtonClick } from 'hooks/useOnBuyButtonClick'; @@ -337,8 +338,9 @@ function ProjectDetails(): JSX.Element { const { canEdit: canEditProject } = getCanEditProject({ role, }); - const canManagePost = getCanManagePost({ role }); - const canViewPost = getCanViewPost({ role }); + const canCreatePost = getCanCreatePost({ + role, + }); // Fetch organization data if project belongs to an organization const organizationId = @@ -386,7 +388,7 @@ function ProjectDetails(): JSX.Element { isCommunityCredit={isCommunityCredit} onBookCallButtonClick={onBookCallButtonClick} canEditProject={canEditProject} - canCreatePost={canManagePost} + canCreatePost={canCreatePost} onBuyButtonClick={() => { onBuyButtonClick({ projectId, @@ -516,8 +518,6 @@ function ProjectDetails(): JSX.Element { projectLocation={projectLocation} openCreatePostModal={openCreatePostModal} setDraftPost={setDraftPost} - canManagePost={canManagePost} - canViewPost={canViewPost} /> { - describe('getCanManagePostWithRole', () => { - it('should allow creating posts for owner role', () => { - const result = getCanManagePost({ role: ROLE_OWNER }); + describe('getCanSeeOrManagePost', () => { + it('should allow managing post for owner role', () => { + const result = getCanSeeOrManagePost({ + role: ROLE_OWNER, + creatorAccountId, + currentAccountId: creatorAccountId, + }); expect(result).toBe(true); }); - it('should allow creating posts for admin role', () => { - const result = getCanManagePost({ role: ROLE_ADMIN }); + it('should allow managing post for admin role', () => { + const result = getCanSeeOrManagePost({ + role: ROLE_ADMIN, + creatorAccountId, + currentAccountId: creatorAccountId, + }); expect(result).toBe(true); }); - it('should allow creating posts for editor role', () => { - const result = getCanManagePost({ role: ROLE_EDITOR }); + it('should allow managing post for editor role', () => { + const result = getCanSeeOrManagePost({ + role: ROLE_EDITOR, + creatorAccountId, + currentAccountId: creatorAccountId, + }); expect(result).toBe(true); }); - it('should allow creating posts for author role', () => { - const result = getCanManagePost({ role: ROLE_AUTHOR }); + it('should allow managing post for author role that is the creator', () => { + const result = getCanSeeOrManagePost({ + role: ROLE_AUTHOR, + creatorAccountId, + currentAccountId: creatorAccountId, + }); expect(result).toBe(true); }); - it('should not allow creating posts for viewer role', () => { - const result = getCanManagePost({ role: ROLE_VIEWER }); + it('should not allow managing post for author role that is not the creator', () => { + const result = getCanSeeOrManagePost({ + role: ROLE_AUTHOR, + creatorAccountId, + currentAccountId: otherAccountId, + }); + + expect(result).toBe(false); + }); + + it('should not allow managing post for viewer role', () => { + const result = getCanSeeOrManagePost({ + role: ROLE_VIEWER, + creatorAccountId, + currentAccountId: otherAccountId, + }); expect(result).toBe(false); }); - it('should not allow creating posts when role is undefined', () => { - const result = getCanManagePost({ role: undefined }); + it('should not allow managing post when role is undefined', () => { + const result = getCanSeeOrManagePost({ + role: undefined, + creatorAccountId, + currentAccountId: otherAccountId, + }); expect(result).toBe(false); }); diff --git a/web-marketplace/src/components/templates/ProjectFormTemplate/ProjectFormAccessTemplate.utils.ts b/web-marketplace/src/components/templates/ProjectFormTemplate/ProjectFormAccessTemplate.utils.ts index 7efb5a0d85..2fc644ae44 100644 --- a/web-marketplace/src/components/templates/ProjectFormTemplate/ProjectFormAccessTemplate.utils.ts +++ b/web-marketplace/src/components/templates/ProjectFormTemplate/ProjectFormAccessTemplate.utils.ts @@ -17,23 +17,74 @@ export const getCanEditProject = ({ role }: GetCanEditProjectParams) => { }; }; -type GetCanManagePostParams = GetCanEditProjectParams; +type GetCanCreatePostParams = GetCanEditProjectParams; -export const getCanManagePost = ({ role }: GetCanManagePostParams) => { +export function getCanCreatePost({ role }: GetCanCreatePostParams) { return ( role === ROLE_OWNER || role === ROLE_ADMIN || role === ROLE_EDITOR || role === ROLE_AUTHOR ); +} + +type CheckPostParams = { + role?: ProjectRole; + creatorAccountId?: string; + currentAccountId?: string; }; -export const getCanViewPost = ({ role }: GetCanManagePostParams) => { - return ( +export function getCanSeeOrManagePost({ + role, + creatorAccountId, + currentAccountId, +}: CheckPostParams) { + if ( role === ROLE_OWNER || role === ROLE_ADMIN || role === ROLE_EDITOR || - role === ROLE_AUTHOR || - role === ROLE_VIEWER - ); -}; + (role === ROLE_AUTHOR && + creatorAccountId && + creatorAccountId === currentAccountId) + ) { + return true; + } + return false; +} + +export function getCanViewPrivatePost({ + role, + creatorAccountId, + currentAccountId, +}: CheckPostParams) { + if ( + role === ROLE_OWNER || + role === ROLE_ADMIN || + role === ROLE_EDITOR || + role === ROLE_VIEWER || + (role === ROLE_AUTHOR && + creatorAccountId && + creatorAccountId === currentAccountId) + ) { + return true; + } + return false; +} + +export function getCanViewDraftPost({ + role, + creatorAccountId, + currentAccountId, +}: CheckPostParams) { + if ( + role === ROLE_OWNER || + role === ROLE_ADMIN || + role === ROLE_EDITOR || + (role === ROLE_AUTHOR && + creatorAccountId && + creatorAccountId === currentAccountId) + ) { + return true; + } + return false; +} diff --git a/web-marketplace/src/legacy-pages/CreateOrganization/hooks/useMigrateProjects/useMigrateProjects.utils.test.ts b/web-marketplace/src/legacy-pages/CreateOrganization/hooks/useMigrateProjects/useMigrateProjects.utils.test.ts index 7e312ed63a..0f0c3d08c4 100644 --- a/web-marketplace/src/legacy-pages/CreateOrganization/hooks/useMigrateProjects/useMigrateProjects.utils.test.ts +++ b/web-marketplace/src/legacy-pages/CreateOrganization/hooks/useMigrateProjects/useMigrateProjects.utils.test.ts @@ -87,7 +87,6 @@ describe('getOrgAssignments', () => { expect.arrayContaining(['owner-addr', 'admin-addr']), ); expect(result.editorAssignments).toEqual(['editor-addr']); - expect(result.authorAssignments).toEqual(['author-addr']); expect(result.viewerAssignments).toEqual(['viewer-addr']); }); diff --git a/web-marketplace/src/legacy-pages/Dashboard/MyProjects/ManageProject.tsx b/web-marketplace/src/legacy-pages/Dashboard/MyProjects/ManageProject.tsx index b9908300a3..b5ccf887d6 100644 --- a/web-marketplace/src/legacy-pages/Dashboard/MyProjects/ManageProject.tsx +++ b/web-marketplace/src/legacy-pages/Dashboard/MyProjects/ManageProject.tsx @@ -18,8 +18,9 @@ import { Link } from 'components/atoms'; import { PostFlow } from 'components/organisms/PostFlow/PostFlow'; import ProjectDashboardBanner from 'components/organisms/ProjectDashboardBanner/ProjectDashboardBanner'; import { + getCanCreatePost, getCanEditProject, - getCanManagePost, + getCanSeeOrManagePost, } from 'components/templates/ProjectFormTemplate/ProjectFormAccessTemplate.utils'; import { useCanAccessManageProjectWithRole } from './hooks/useCanAccessManageProjectWithRole'; @@ -94,7 +95,9 @@ const ManageProject = () => { const { canEdit: canEditProject } = getCanEditProject({ role, }); - const canManagePost = getCanManagePost({ role }); + const canCreatePost = getCanCreatePost({ + role, + }); if (isLoading) return ; @@ -106,7 +109,7 @@ const ManageProject = () => { { setPostProjectId(project.id); setPostOffChainProjectId(project.offChainId); @@ -138,7 +141,7 @@ const ManageProject = () => { {/* Content section */} - {canManagePost && postProjectId && ( + {canCreatePost && postProjectId && ( { setPostProjectId(undefined); diff --git a/web-marketplace/src/legacy-pages/Post/Post.Header.tsx b/web-marketplace/src/legacy-pages/Post/Post.Header.tsx index bd3cad4eeb..c93558faa1 100644 --- a/web-marketplace/src/legacy-pages/Post/Post.Header.tsx +++ b/web-marketplace/src/legacy-pages/Post/Post.Header.tsx @@ -37,7 +37,7 @@ import { type Props = { projectHref: string; - isAdmin: boolean; + canManagePost: boolean; title: string; creatorAccount: AccountByIdQuery['accountById']; adminAccountId: string; @@ -51,7 +51,7 @@ type Props = { export const PostHeader = ({ projectHref, - isAdmin, + canManagePost, title, creatorAccount, creatorIsAdmin, @@ -74,7 +74,7 @@ export const PostHeader = ({ return (
@@ -98,7 +98,7 @@ export const PostHeader = ({ {_(ALL_POSTS)} - {isAdmin ? ( + {canManagePost ? (
{privatePost && ( )} - {isAdmin && ( + {canManagePost && ( + getCanSeeOrManagePost({ + role, + creatorAccountId, + currentAccountId, + }), + [role, creatorAccountId, currentAccountId], + ); + const canViewPrivatePost = useMemo( + () => + getCanViewPrivatePost({ + role, + creatorAccountId, + currentAccountId, + }), + [role, creatorAccountId, currentAccountId], + ); + const canViewDraftPost = useMemo( + () => + getCanViewDraftPost({ + role, + creatorAccountId, + currentAccountId, + }), + [role, creatorAccountId, currentAccountId], + ); + return ( <> - {!isFetching && (!data || (isAdmin && !data?.published)) ? ( + {!isFetching && (!data || (canViewDraftPost && !data?.published)) ? ( ) : ( <> - {!loadingOffchainProjectById && !isAdmin && privatePostError && ( + {!loadingProject && !canViewPrivatePost && privatePostError && ( )} - {!loadingOffchainProjectById && + {!loadingProject && data?.contents && - (!privatePostError || isAdmin) && ( + (!privatePostError || canViewPrivatePost) && ( <> 0 && (
- {(isAdmin || !privateFiles) && ( + {(canViewPrivatePost || !privateFiles) && ( From 8aea233ff457f50c0c37af25b6941107191a01a2 Mon Sep 17 00:00:00 2001 From: blushi Date: Tue, 10 Mar 2026 09:35:44 +0100 Subject: [PATCH 3/3] fix: ts error and review --- .../ProjectDetails.DataStream.tsx | 4 +++- .../ProjectDetails/ProjectDetails.tsx | 2 ++ .../ProjectFormAccessTemplate.utils.ts | 18 ------------------ web-marketplace/src/legacy-pages/Post/Post.tsx | 3 +-- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx index 047ad40d86..966d907804 100644 --- a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx +++ b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.DataStream.tsx @@ -50,6 +50,7 @@ type Props = { openCreatePostModal: () => void; setDraftPost: UseStateSetter | undefined>; role?: ProjectRole; + canCreatePost: boolean; }; export const DataStream = ({ @@ -61,6 +62,7 @@ export const DataStream = ({ openCreatePostModal, setDraftPost, role, + canCreatePost, }: Props) => { const { _ } = useLingui(); const [selectedLanguage] = useAtom(selectedLanguageAtom); @@ -109,7 +111,7 @@ export const DataStream = ({ titleAlign="left" className="mb-50 sm:mb-[100px] pt-0" > - {canManagePost && adminDescription && projectLocation && ( + {canCreatePost && adminDescription && projectLocation && (
diff --git a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx index 791fe4641f..d41e28f27c 100644 --- a/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx +++ b/web-marketplace/src/components/templates/ProjectDetails/ProjectDetails.tsx @@ -518,6 +518,8 @@ function ProjectDetails(): JSX.Element { projectLocation={projectLocation} openCreatePostModal={openCreatePostModal} setDraftPost={setDraftPost} + role={role} + canCreatePost={canCreatePost} /> - getCanViewDraftPost({ + getCanSeeOrManagePost({ role, creatorAccountId, currentAccountId,