From ceac75ee76c0156721e8952c148383e7d7cf4f14 Mon Sep 17 00:00:00 2001 From: dragnoir Date: Wed, 8 May 2024 21:13:18 +0100 Subject: [PATCH 1/3] Fix: display joined public rooms in search results --- src/libs/OptionsListUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 082952e58f9e..28545ca55eb4 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1484,6 +1484,7 @@ function createOptionList(personalDetails: OnyxEntry, repor } const isSelfDM = ReportUtils.isSelfDM(report); + const isChatRoom = ReportUtils.isChatRoom(report); let accountIDs = []; if (isSelfDM) { @@ -1497,7 +1498,7 @@ function createOptionList(personalDetails: OnyxEntry, repor } } - if (!accountIDs || accountIDs.length === 0) { + if ((!accountIDs || accountIDs.length === 0) && !isChatRoom) { return; } @@ -1783,6 +1784,7 @@ function getOptions( const isPolicyExpenseChat = option.isPolicyExpenseChat; const isMoneyRequestReport = option.isMoneyRequestReport; const isSelfDM = option.isSelfDM; + const isChatRoom = option.isChatRoom; let accountIDs = []; if (isSelfDM) { @@ -1826,7 +1828,7 @@ function getOptions( return; } - if (!accountIDs || accountIDs.length === 0) { + if ((!accountIDs || accountIDs.length === 0) && !isChatRoom) { return; } From 9502c60203fa360775ea9c01e685751bad16d86d Mon Sep 17 00:00:00 2001 From: dragnoir Date: Mon, 20 May 2024 12:54:24 +0100 Subject: [PATCH 2/3] revert --- src/libs/OptionsListUtils.ts | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index d54fd8c9817a..544ced533e82 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1491,27 +1491,13 @@ function createOptionList(personalDetails: OnyxEntry, repor return; } - const isSelfDM = ReportUtils.isSelfDM(report); - const isChatRoom = ReportUtils.isChatRoom(report); - let accountIDs = []; - - if (isSelfDM) { - // For selfDM we need to add the currentUser as participants. - accountIDs = [currentUserAccountID ?? 0]; - } else { - accountIDs = Object.keys(report.participants ?? {}).map(Number); - if (ReportUtils.isOneOnOneChat(report)) { - // For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants - accountIDs = accountIDs.filter((accountID) => accountID !== currentUserAccountID); - } - } // For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants const isOneOnOneChat = ReportUtils.isOneOnOneChat(report); const accountIDs = Object.keys(report.participants ?? {}) .map(Number) .filter((accountID) => accountID !== currentUserAccountID || !isOneOnOneChat); - if ((!accountIDs || accountIDs.length === 0) && !isChatRoom) { + if (!accountIDs || accountIDs.length === 0) { return; } @@ -1801,19 +1787,6 @@ function getOptions( const isPolicyExpenseChat = option.isPolicyExpenseChat; const isMoneyRequestReport = option.isMoneyRequestReport; const isSelfDM = option.isSelfDM; - const isChatRoom = option.isChatRoom; - let accountIDs = []; - - if (isSelfDM) { - // For selfDM we need to add the currentUser as participants. - accountIDs = [currentUserAccountID ?? 0]; - } else { - accountIDs = Object.keys(report.participants ?? {}).map(Number); - if (ReportUtils.isOneOnOneChat(report)) { - // For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants - accountIDs = accountIDs.filter((accountID) => accountID !== currentUserAccountID); - } - } const isOneOnOneChat = option.isOneOnOneChat; // For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants @@ -1851,7 +1824,7 @@ function getOptions( return; } - if ((!accountIDs || accountIDs.length === 0) && !isChatRoom) { + if (!accountIDs || accountIDs.length === 0) { return; } From 2399004cbbcb9a38ecf1952a29a513f716dcd7aa Mon Sep 17 00:00:00 2001 From: dragnoir Date: Mon, 20 May 2024 13:13:24 +0100 Subject: [PATCH 3/3] clean --- src/libs/OptionsListUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 544ced533e82..6747f90b2f73 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1497,7 +1497,8 @@ function createOptionList(personalDetails: OnyxEntry, repor .map(Number) .filter((accountID) => accountID !== currentUserAccountID || !isOneOnOneChat); - if (!accountIDs || accountIDs.length === 0) { + const isChatRoom = ReportUtils.isChatRoom(report); + if ((!accountIDs || accountIDs.length === 0) && !isChatRoom) { return; } @@ -1788,6 +1789,7 @@ function getOptions( const isMoneyRequestReport = option.isMoneyRequestReport; const isSelfDM = option.isSelfDM; const isOneOnOneChat = option.isOneOnOneChat; + const isChatRoom = option.isChatRoom; // For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants const accountIDs = Object.keys(report.participants ?? {}) @@ -1824,7 +1826,7 @@ function getOptions( return; } - if (!accountIDs || accountIDs.length === 0) { + if ((!accountIDs || accountIDs.length === 0) && !isChatRoom) { return; }