Skip to content

Commit

Permalink
show op profile if you are not the author (#4862)
Browse files Browse the repository at this point in the history
* show op profile if you are not the author

* fix types
  • Loading branch information
mattcasey authored Oct 21, 2024
1 parent 6e9ceb5 commit 0635898
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/[pageId]/DocumentPage/DocumentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ function DocumentPageComponent({
getFieldState={getFieldState}
onSave={onSave}
pageId={page.id}
isAuthor={proposalAuthors.includes(user?.id || '')}
threads={threads}
// This is required to reinstate the form field state after the proposal is published, necessary to show the correct project id
key={proposal?.status === 'draft' ? 'draft' : 'published'}
Expand Down
4 changes: 3 additions & 1 deletion components/common/form/FormFieldAnswers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type FormFieldAnswersProps = {
values?: Record<string, FormFieldValue>;
pageId?: string;
isDraft?: boolean;
isAuthor: boolean;
threads?: Record<string, ThreadWithComments | undefined>;
projectId?: string | null;
proposalId: string;
Expand All @@ -71,6 +72,7 @@ export function FormFieldAnswers({
onSave,
formFields,
disabled,
isAuthor,
enableComments,
getFieldState,
control,
Expand Down Expand Up @@ -233,7 +235,7 @@ export function FormFieldAnswers({
)
}
description={formField.description as PageContent}
disabled={disabled}
disabled={disabled || (!isAuthor && formField.type === 'optimism_project_profile')}
type={formField.type === 'short_text' ? 'text_multiline' : formField.type}
label={formField.name}
options={formField.options as SelectOptionType[]}
Expand Down
2 changes: 2 additions & 0 deletions stories/FormFields/FormFields.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function FormFieldsInputs() {
<GlobalContext>
<CustomFormFieldAnswers
{...props}
isAuthor={true}
enableComments={true}
proposalId=''
applyProject={() => {}}
Expand Down Expand Up @@ -172,6 +173,7 @@ export function FormFieldsInputsDisplay() {
<GlobalContext>
<CustomFormFieldAnswers
{...props}
isAuthor={true}
proposalId=''
enableComments={true}
applyProject={() => {}}
Expand Down

0 comments on commit 0635898

Please sign in to comment.