[WEB-1028] fix: enable comments and issue reactions for guest/ viewer. (#4231)

This commit is contained in:
Prateek Shourya 2024-04-18 20:36:24 +05:30 committed by GitHub
parent cb9fda8557
commit 086d14609c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 6 deletions

View File

@ -24,11 +24,12 @@ type Props = {
issueId: string; issueId: string;
issueOperations: TIssueOperations; issueOperations: TIssueOperations;
isEditable: boolean; isEditable: boolean;
isArchived: boolean;
swrIssueDetails: TIssue | null | undefined; swrIssueDetails: TIssue | null | undefined;
}; };
export const IssueMainContent: React.FC<Props> = observer((props) => { export const IssueMainContent: React.FC<Props> = observer((props) => {
const { workspaceSlug, projectId, issueId, issueOperations, isEditable, swrIssueDetails } = props; const { workspaceSlug, projectId, issueId, issueOperations, isEditable, isArchived, swrIssueDetails } = props;
// states // states
const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved"); const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved");
// hooks // hooks
@ -105,6 +106,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
projectId={projectId} projectId={projectId}
issueId={issueId} issueId={issueId}
currentUser={currentUser} currentUser={currentUser}
disabled={isArchived}
/> />
)} )}
@ -126,7 +128,7 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
disabled={!isEditable} disabled={!isEditable}
/> />
<IssueActivity workspaceSlug={workspaceSlug} projectId={projectId} issueId={issueId} disabled={!isEditable} /> <IssueActivity workspaceSlug={workspaceSlug} projectId={projectId} issueId={issueId} disabled={isArchived} />
</> </>
); );
}); });

View File

@ -365,6 +365,7 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
issueId={issueId} issueId={issueId}
issueOperations={issueOperations} issueOperations={issueOperations}
isEditable={!is_archived && isEditable} isEditable={!is_archived && isEditable}
isArchived={is_archived}
/> />
</div> </div>
<div <div

View File

@ -16,12 +16,13 @@ interface IPeekOverviewIssueDetails {
issueId: string; issueId: string;
issueOperations: TIssueOperations; issueOperations: TIssueOperations;
disabled: boolean; disabled: boolean;
isArchived: boolean;
isSubmitting: "submitting" | "submitted" | "saved"; isSubmitting: "submitting" | "submitted" | "saved";
setIsSubmitting: (value: "submitting" | "submitted" | "saved") => void; setIsSubmitting: (value: "submitting" | "submitted" | "saved") => void;
} }
export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer((props) => { export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer((props) => {
const { workspaceSlug, issueId, issueOperations, disabled, isSubmitting, setIsSubmitting } = props; const { workspaceSlug, issueId, issueOperations, disabled, isArchived, isSubmitting, setIsSubmitting } = props;
// store hooks // store hooks
const { getProjectById } = useProject(); const { getProjectById } = useProject();
const { currentUser } = useUser(); const { currentUser } = useUser();
@ -88,7 +89,7 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(
projectId={issue.project_id} projectId={issue.project_id}
issueId={issueId} issueId={issueId}
currentUser={currentUser} currentUser={currentUser}
disabled={disabled} disabled={isArchived}
/> />
)} )}
</div> </div>

View File

@ -157,6 +157,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
issueId={issueId} issueId={issueId}
issueOperations={issueOperations} issueOperations={issueOperations}
disabled={disabled || is_archived} disabled={disabled || is_archived}
isArchived={is_archived}
isSubmitting={isSubmitting} isSubmitting={isSubmitting}
setIsSubmitting={(value) => setIsSubmitting(value)} setIsSubmitting={(value) => setIsSubmitting(value)}
/> />
@ -190,7 +191,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
workspaceSlug={workspaceSlug} workspaceSlug={workspaceSlug}
projectId={projectId} projectId={projectId}
issueId={issueId} issueId={issueId}
disabled={disabled || is_archived} disabled={is_archived}
/> />
</div> </div>
) : ( ) : (
@ -203,6 +204,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
issueId={issueId} issueId={issueId}
issueOperations={issueOperations} issueOperations={issueOperations}
disabled={disabled || is_archived} disabled={disabled || is_archived}
isArchived={is_archived}
isSubmitting={isSubmitting} isSubmitting={isSubmitting}
setIsSubmitting={(value) => setIsSubmitting(value)} setIsSubmitting={(value) => setIsSubmitting(value)}
/> />
@ -228,7 +230,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
workspaceSlug={workspaceSlug} workspaceSlug={workspaceSlug}
projectId={projectId} projectId={projectId}
issueId={issueId} issueId={issueId}
disabled={disabled || is_archived} disabled={is_archived}
/> />
</div> </div>
</div> </div>