Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/pages/FlagCommentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as Report from '@userActions/Report';
import * as Session from '@userActions/Session';
Expand Down Expand Up @@ -43,10 +42,15 @@ const propTypes = {
}).isRequired,

...withLocalizePropTypes,

/* Onyx Props */
/** All the report actions from the parent report */
parentReportActions: PropTypes.objectOf(PropTypes.shape(reportActionPropTypes)),
};

const defaultProps = {
reportActions: {},
parentReportActions: {},
report: {},
};

Expand Down Expand Up @@ -120,18 +124,19 @@ function FlagCommentPage(props) {

// Handle threads if needed
if (reportAction === undefined || reportAction.reportActionID === undefined) {
reportAction = ReportActionsUtils.getParentReportAction(props.report);
reportAction = props.parentReportActions[props.report.parentReportActionID] || {};
}

return reportAction;
}, [props.report, props.reportActions, props.route.params.reportActionID]);
}, [props.report, props.reportActions, props.route.params.reportActionID, props.parentReportActions]);

const flagComment = (severity) => {
let reportID = getReportID(props.route);
const reportAction = getActionToFlag();
const parentReportAction = props.parentReportActions[props.report.parentReportActionID] || {};

// Handle threads if needed
if (ReportUtils.isChatThread(props.report) && reportAction.reportActionID === ReportActionsUtils.getParentReportAction(props.report).reportActionID) {
if (ReportUtils.isChatThread(props.report) && reportAction.reportActionID === parentReportAction.reportActionID) {
reportID = ReportUtils.getParentReport(props.report).reportID;
}

Expand Down