-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Make all task titles/descriptions read-only to all but the author/assignee. #53749
base: main
Are you sure you want to change the base?
Changes from all commits
8fcb133
737d469
0e46d44
fd36917
eb1df5b
b78d7bc
6ff76aa
59ccd0c
4d9471e
9317132
2d66f39
880cbed
7dd9409
5609459
2a02141
9fb9594
6b7bd35
a13be8a
bc6034d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -365,8 +365,8 @@ function getOutstandingChildTask(taskReport: OnyxEntry<OnyxTypes.Report>) { | |||||
/** | ||||||
* Complete a task | ||||||
*/ | ||||||
function completeTask(taskReport: OnyxEntry<OnyxTypes.Report>) { | ||||||
const taskReportID = taskReport?.reportID ?? '-1'; | ||||||
function completeTask(taskReport: OnyxEntry<OnyxTypes.Report>, reportIDFromAction?: string) { | ||||||
const taskReportID = taskReport?.reportID ?? reportIDFromAction ?? '-1'; | ||||||
const message = `marked as complete`; | ||||||
const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASK_COMPLETED, message); | ||||||
const parentReport = getParentReport(taskReport); | ||||||
|
@@ -450,8 +450,8 @@ function completeTask(taskReport: OnyxEntry<OnyxTypes.Report>) { | |||||
/** | ||||||
* Reopen a closed task | ||||||
*/ | ||||||
function reopenTask(taskReport: OnyxEntry<OnyxTypes.Report>) { | ||||||
const taskReportID = taskReport?.reportID ?? '-1'; | ||||||
function reopenTask(taskReport: OnyxEntry<OnyxTypes.Report>, reportIDFromAction?: string) { | ||||||
const taskReportID = taskReport?.reportID ?? reportIDFromAction ?? '-1'; | ||||||
const message = `marked as incomplete`; | ||||||
const reopenedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASK_REOPENED, message); | ||||||
const parentReport = getParentReport(taskReport); | ||||||
|
@@ -1216,7 +1216,19 @@ function getTaskOwnerAccountID(taskReport: OnyxEntry<OnyxTypes.Report>): number | |||||
/** | ||||||
* Check if you're allowed to modify the task - anyone that has write access to the report can modify the task, except auditor | ||||||
*/ | ||||||
function canModifyTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID: number): boolean { | ||||||
function canModifyTask( | ||||||
taskReport: OnyxEntry<OnyxTypes.Report>, | ||||||
sessionAccountID: number, | ||||||
allowEditingConciergeTask?: boolean, | ||||||
taskOwnerAccountID?: number, | ||||||
taskAssigneeAccountID?: number, | ||||||
Comment on lines
+1223
to
+1224
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Do we have a use case that requires using this parameter? If the change comes from a previous update, I think we can consider remove this prop. (the same with the canActionTask function) |
||||||
): boolean { | ||||||
const ownerAccountID = getTaskOwnerAccountID(taskReport) ?? taskOwnerAccountID; | ||||||
const assigneeAccountID = getTaskAssigneeAccountID(taskReport) ?? taskAssigneeAccountID; | ||||||
if (ownerAccountID === CONST.ACCOUNT_ID.CONCIERGE && !allowEditingConciergeTask) { | ||||||
return false; | ||||||
} | ||||||
|
||||||
if (ReportUtils.isCanceledTaskReport(taskReport)) { | ||||||
return false; | ||||||
} | ||||||
|
@@ -1227,7 +1239,7 @@ function canModifyTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID | |||||
return false; | ||||||
} | ||||||
|
||||||
if (sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport)) { | ||||||
if (sessionAccountID === ownerAccountID || sessionAccountID === assigneeAccountID) { | ||||||
return true; | ||||||
} | ||||||
|
||||||
|
@@ -1241,8 +1253,10 @@ function canModifyTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID | |||||
/** | ||||||
* Check if you can change the status of the task (mark complete or incomplete). Only the task owner and task assignee can do this. | ||||||
*/ | ||||||
function canActionTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID: number): boolean { | ||||||
return sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport); | ||||||
function canActionTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID: number, taskOwnerAccountID?: number, taskAssigneeAccountID?: number): boolean { | ||||||
const ownerAccountID = getTaskOwnerAccountID(taskReport) ?? taskOwnerAccountID; | ||||||
const assigneeAccountID = getTaskAssigneeAccountID(taskReport) ?? taskAssigneeAccountID; | ||||||
return sessionAccountID === ownerAccountID || sessionAccountID === assigneeAccountID; | ||||||
} | ||||||
|
||||||
function clearTaskErrors(reportID: string) { | ||||||
|
@@ -1286,9 +1300,9 @@ export { | |||||
getTaskAssigneeAccountID, | ||||||
clearTaskErrors, | ||||||
canModifyTask, | ||||||
canActionTask, | ||||||
setNewOptimisticAssignee, | ||||||
getNavigationUrlOnTaskDelete, | ||||||
canActionTask, | ||||||
}; | ||||||
|
||||||
export type {PolicyValue, Assignee, ShareDestination}; |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -20,6 +20,7 @@ import SubscriptAvatar from '@components/SubscriptAvatar'; | |||||||||
import TaskHeaderActionButton from '@components/TaskHeaderActionButton'; | ||||||||||
import Text from '@components/Text'; | ||||||||||
import Tooltip from '@components/Tooltip'; | ||||||||||
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||||||||||
import useLocalize from '@hooks/useLocalize'; | ||||||||||
import usePolicy from '@hooks/usePolicy'; | ||||||||||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||||||||||
|
@@ -75,6 +76,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto | |||||||||
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || report?.reportID || '-1'}`); | ||||||||||
const policy = usePolicy(report?.policyID); | ||||||||||
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); | ||||||||||
const {accountID} = useCurrentUserPersonalDetails(); | ||||||||||
|
||||||||||
const {translate} = useLocalize(); | ||||||||||
const theme = useTheme(); | ||||||||||
|
@@ -288,7 +290,9 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto | |||||||||
</PressableWithoutFeedback> | ||||||||||
<View style={[styles.reportOptions, styles.flexRow, styles.alignItemsCenter]}> | ||||||||||
{!shouldUseNarrowLayout && isChatUsedForOnboarding && freeTrialButton} | ||||||||||
{isTaskReport && !shouldUseNarrowLayout && ReportUtils.isOpenTaskReport(report, parentReportAction) && <TaskHeaderActionButton report={report} />} | ||||||||||
{isTaskReport && !shouldUseNarrowLayout && ReportUtils.isOpenTaskReport(report, parentReportAction) && Task.canActionTask(report, accountID) && ( | ||||||||||
<TaskHeaderActionButton report={report} /> | ||||||||||
)} | ||||||||||
Comment on lines
+293
to
+295
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We should revert the condition checking |
||||||||||
{!isParentReportLoading && canJoin && !shouldUseNarrowLayout && joinButton} | ||||||||||
</View> | ||||||||||
{shouldDisplaySearchRouter && <SearchButton style={styles.ml2} />} | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a use case that requires using this parameter? If the change comes from a previous update, I think we can consider remove this prop (the same with the reopenTask function)