Skip to content

Commit

Permalink
Add Session check for TaskHeaderActionButton
Browse files Browse the repository at this point in the history
onPress.
  • Loading branch information
marcochavezf committed Nov 10, 2023
1 parent 9aa6ae1 commit f59b181
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/TaskHeaderActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import compose from '@libs/compose';
import * as ReportUtils from '@libs/ReportUtils';
import reportPropTypes from '@pages/reportPropTypes';
import styles from '@styles/styles';
import * as Session from '@userActions/Session';
import * as Task from '@userActions/Task';
import ONYXKEYS from '@src/ONYXKEYS';
import Button from './Button';
Expand Down Expand Up @@ -37,7 +38,7 @@ function TaskHeaderActionButton(props) {
isDisabled={!Task.canModifyTask(props.report, props.session.accountID)}
medium
text={props.translate(ReportUtils.isCompletedTaskReport(props.report) ? 'task.markAsIncomplete' : 'task.markAsComplete')}
onPress={() => (ReportUtils.isCompletedTaskReport(props.report) ? Task.reopenTask(props.report) : Task.completeTask(props.report))}
onPress={Session.checkIfActionIsAllowed(() => (ReportUtils.isCompletedTaskReport(props.report) ? Task.reopenTask(props.report) : Task.completeTask(props.report)))}
style={[styles.flex1]}
/>
</View>
Expand Down

0 comments on commit f59b181

Please sign in to comment.