Skip to content

Commit

Permalink
Merge pull request #28252 from dukenv0307/fix/27891
Browse files Browse the repository at this point in the history
fix: can edit private note of archived workspace using URL
  • Loading branch information
puneetlath authored Sep 28, 2023
2 parents 109e96c + f84b1d9 commit 67d4a7a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/pages/PrivateNotes/PrivateNotesEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import useLocalize from '../../hooks/useLocalize';
import OfflineWithFeedback from '../../components/OfflineWithFeedback';
import updateMultilineInputRange from '../../libs/UpdateMultilineInputRange';
import ROUTES from '../../ROUTES';
import * as ReportUtils from '../../libs/ReportUtils';

const propTypes = {
/** All of the personal details for everyone */
Expand Down Expand Up @@ -100,7 +101,13 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) {
testID={PrivateNotesEditPage.displayName}
>
<FullPageNotFoundView
shouldShow={_.isEmpty(report) || _.isEmpty(report.privateNotes) || !_.has(report, ['privateNotes', route.params.accountID, 'note']) || !isCurrentUserNote}
shouldShow={
_.isEmpty(report) ||
_.isEmpty(report.privateNotes) ||
!_.has(report, ['privateNotes', route.params.accountID, 'note']) ||
!isCurrentUserNote ||
ReportUtils.isArchivedRoom(report)
}
subtitleKey="privateNotes.notesUnavailable"
>
<HeaderWithBackButton
Expand Down
9 changes: 8 additions & 1 deletion src/pages/PrivateNotes/PrivateNotesListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import HeaderWithBackButton from '../../components/HeaderWithBackButton';
import {withNetwork} from '../../components/OnyxProvider';
import networkPropTypes from '../../components/networkPropTypes';
import ROUTES from '../../ROUTES';
import * as ReportUtils from '../../libs/ReportUtils';

const propTypes = {
/** The report currently being looked at */
Expand Down Expand Up @@ -122,7 +123,13 @@ function PrivateNotesListPage({report, personalDetailsList, network, session}) {
includeSafeAreaPaddingBottom={false}
testID={PrivateNotesListPage.displayName}
>
<FullPageNotFoundView shouldShow={_.isEmpty(report.reportID) || (!report.isLoadingPrivateNotes && network.isOffline && _.isEmpty(lodashGet(report, 'privateNotes', {})))}>
<FullPageNotFoundView
shouldShow={
_.isEmpty(report.reportID) ||
(!report.isLoadingPrivateNotes && network.isOffline && _.isEmpty(lodashGet(report, 'privateNotes', {}))) ||
ReportUtils.isArchivedRoom(report)
}
>
<HeaderWithBackButton
title={translate('privateNotes.title')}
shouldShowBackButton
Expand Down
3 changes: 2 additions & 1 deletion src/pages/PrivateNotes/PrivateNotesViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useLocalize from '../../hooks/useLocalize';
import OfflineWithFeedback from '../../components/OfflineWithFeedback';
import MenuItemWithTopDescription from '../../components/MenuItemWithTopDescription';
import CONST from '../../CONST';
import * as ReportUtils from '../../libs/ReportUtils';

const propTypes = {
/** All of the personal details for everyone */
Expand Down Expand Up @@ -61,7 +62,7 @@ function PrivateNotesViewPage({route, personalDetailsList, session, report}) {
testID={PrivateNotesViewPage.displayName}
>
<FullPageNotFoundView
shouldShow={_.isEmpty(report) || _.isEmpty(report.privateNotes) || !_.has(report, ['privateNotes', route.params.accountID, 'note'])}
shouldShow={_.isEmpty(report) || _.isEmpty(report.privateNotes) || !_.has(report, ['privateNotes', route.params.accountID, 'note']) || ReportUtils.isArchivedRoom(report)}
subtitleKey="privateNotes.notesUnavailable"
>
<HeaderWithBackButton
Expand Down

0 comments on commit 67d4a7a

Please sign in to comment.