Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ function createOption(logins, personalDetails, report, reportActions = {}, {show
result.isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
result.isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report);
result.isThread = ReportUtils.isThread(report);
result.isTaskReport = ReportUtils.isTaskReport(report);
result.shouldShowSubscript = result.isPolicyExpenseChat && !report.isOwnPolicyExpenseChat && !result.isArchivedRoom;
result.allReportErrors = getAllReportErrors(report, reportActions);
result.brickRoadIndicator = !_.isEmpty(result.allReportErrors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
Expand Down Expand Up @@ -549,6 +550,7 @@ function getOptions(
forcePolicyNamePreview = false,
includeOwnedWorkspaceChats = false,
includeThreads = false,
includeTasks = false,

@rushatgabhane rushatgabhane Aug 2, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, this PR caused a bug - Task name is not appearing in search page

},
) {
if (!isPersonalDetailsReady(personalDetails)) {
Expand Down Expand Up @@ -590,6 +592,7 @@ function getOptions(

const isThread = ReportUtils.isThread(report);
const isChatRoom = ReportUtils.isChatRoom(report);
const isTaskReport = ReportUtils.isTaskReport(report);
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
const logins = report.participants || [];

Expand All @@ -601,6 +604,10 @@ function getOptions(
return;
}

if (isTaskReport && !includeTasks) {
return;
}

// Save the report in the map if this is a single participant so we can associate the reportID with the
// personal detail option later. Individuals should not be associated with single participant
// policyExpenseChats or chatRooms since those are not people.
Expand Down
8 changes: 6 additions & 2 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function isPolicyExpenseChatAdmin(report, policies) {
* @returns {Boolean}
*/
function isThread(report) {
return Boolean(report && report.parentReportID && report.parentReportActionID);
return Boolean(report && report.parentReportID && report.parentReportActionID && report.type === CONST.REPORT.TYPE.CHAT);
}

/**
Expand Down Expand Up @@ -1844,7 +1844,11 @@ function shouldReportBeInOptionList(report, reportIDFromRoute, isInGSDMode, curr
// Exclude reports that have no data because there wouldn't be anything to show in the option item.
// This can happen if data is currently loading from the server or a report is in various stages of being created.
// This can also happen for anyone accessing a public room or archived room for which they don't have access to the underlying policy.
if (!report || !report.reportID || (_.isEmpty(report.participants) && !isThread(report) && !isPublicRoom(report) && !isArchivedRoom(report) && !isMoneyRequestReport(report))) {
if (
!report ||
!report.reportID ||
(_.isEmpty(report.participants) && !isThread(report) && !isPublicRoom(report) && !isArchivedRoom(report) && !isMoneyRequestReport(report) && !isTaskReport(report))
) {
Comment thread
thienlnam marked this conversation as resolved.
return false;
}

Expand Down
8 changes: 3 additions & 5 deletions src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ function getOrderedReportIDs(reportIDFromRoute) {
return;
}

if (ReportUtils.isTaskReport(report)) {
if (ReportUtils.isTaskReport(report) && report.stateNum !== CONST.REPORT.STATE.OPEN && report.statusNum !== CONST.REPORT.STATUS.OPEN) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed Tasks should not be moved to archived reports as a user can still message on the thread. This created #23883 issue.

archivedReports.push(report);
return;
}

Expand Down Expand Up @@ -303,10 +304,8 @@ function getOptionData(reportID) {
});
}

if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread) && !result.isArchivedRoom) {
if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport) && !result.isArchivedRoom) {
result.alternateText = lastMessageTextFromReport.length > 0 ? lastMessageText : Localize.translate(preferredLocale, 'report.noActivityYet');
} else if (result.isTaskReport) {
result.alternateText = Localize.translate(preferredLocale, 'newTaskPage.task');
} else {
if (!lastMessageText) {
// Here we get the beginning of chat history message and append the display name for each user, adding pronouns if there are any.
Expand Down Expand Up @@ -349,7 +348,6 @@ function getOptionData(reportID) {
result.icons = ReportUtils.getIcons(result.isTaskReport ? parentReport : report, personalDetails, policies, ReportUtils.getAvatar(personalDetail.avatar, personalDetail.login));
result.searchText = OptionsListUtils.getSearchText(report, reportName, participantPersonalDetailList, result.isChatRoom || result.isPolicyExpenseChat);
result.displayNamesWithTooltips = displayNamesWithTooltips;

return result;
}

Expand Down
4 changes: 4 additions & 0 deletions src/libs/isReportMessageAttachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import CONST from '../CONST';
* @returns {Boolean}
*/
export default function isReportMessageAttachment({text, html}) {
if (!text || !html) {
return false;
}

const regex = new RegExp(` ${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}="(.*)"`, 'i');
return text === CONST.ATTACHMENT_MESSAGE_TEXT && !!html.match(regex);
}
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ReportFooter extends React.Component {

render() {
const isArchivedRoom = ReportUtils.isArchivedRoom(this.props.report);
const hideComposer = isArchivedRoom || !_.isEmpty(this.props.errors) || ReportUtils.isTaskReport(this.props.report);
const hideComposer = isArchivedRoom || !_.isEmpty(this.props.errors);

return (
<>
Expand Down