Skip to content
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

Update archive feature #46934

Merged
merged 24 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ function getHeaderMessageForNonUserList(hasSelectableOptions: boolean, searchVal
* Helper method to check whether an option can show tooltip or not
*/
function shouldOptionShowTooltip(option: ReportUtils.OptionData): boolean {
return (!option.isChatRoom || !!option.isThread) && !option.isArchivedRoom;
return (!option.isChatRoom || !!option.isThread) && !ReportUtils.isArchivedRoom(option, ReportUtils.getReportNameValuePairs(option?.reportID));
cretadn22 marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ type OptionData = {
hasDraftComment?: boolean | null;
keyForList?: string;
searchText?: string;
private_isArchived?: string | null;
isIOUReportOwner?: boolean | null;
isArchivedRoom?: boolean | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

@srikarparsi is it fine to keep both (private_isArchived, isArchivedRoom) in OptionData?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srikarparsi Could you give your opinion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srikarparsi Could you give your opinion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, didn't see this. Please correct me if I'm wrong but OptionData includes all the attributes from Report right (which already has private_isArchived)? So do we need to declare this twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srikarparsi Right, I updated

shouldShowSubscript?: boolean | null;
Expand Down
11 changes: 6 additions & 5 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ function getOptionData({
hasParentAccess: undefined,
isIOUReportOwner: null,
isChatRoom: false,
isArchivedRoom: false,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: undefined,
cretadn22 marked this conversation as resolved.
Show resolved Hide resolved
shouldShowSubscript: false,
isPolicyExpenseChat: false,
isMoneyRequestReport: false,
Expand All @@ -302,8 +303,8 @@ function getOptionData({
result.isTaskReport = ReportUtils.isTaskReport(report);
result.isInvoiceReport = ReportUtils.isInvoiceReport(report);
result.parentReportAction = parentReportAction;
const reportNameValuePairs = ReportUtils.getReportNameValuePairs(report?.reportID);
result.isArchivedRoom = ReportUtils.isArchivedRoom(report, reportNameValuePairs);
// eslint-disable-next-line @typescript-eslint/naming-convention
result.private_isArchived = report.private_isArchived;
result.isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
result.isExpenseRequest = ReportUtils.isExpenseRequest(report);
result.isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report);
Expand Down Expand Up @@ -390,8 +391,8 @@ function getOptionData({

const isThreadMessage =
ReportUtils.isThread(report) && lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT && lastAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;

if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport || isThreadMessage) && !result.isArchivedRoom) {
const reportNameValuePairs = ReportUtils.getReportNameValuePairs(report?.reportID);
if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport || isThreadMessage) && !ReportUtils.isArchivedRoom(report, reportNameValuePairs)) {
const lastActionName = lastAction?.actionName ?? report.lastActionType;

if (ReportActionsUtils.isRenamedAction(lastAction)) {
Expand Down
Loading