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

fix: remove deprecated getChatByParticipantsByLoginList method #27828

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
23 changes: 0 additions & 23 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2954,28 +2954,6 @@ function getChatByParticipants(newParticipantList) {
});
}

/**
* Attempts to find a report in onyx with the provided email list of participants. Does not include threads
* This is temporary function while migrating from PersonalDetails to PersonalDetailsList
*
* @deprecated - use getChatByParticipants()
*
* @param {Array} participantsLoginList
* @returns {Array|undefined}
*/
function getChatByParticipantsByLoginList(participantsLoginList) {
participantsLoginList.sort();
return _.find(allReports, (report) => {
// If the report has been deleted, or there are no participants (like an empty #admins room) then skip it
if (!report || _.isEmpty(report.participantAccountIDs) || isThread(report)) {
return false;
}

// Only return the room if it has all the participants and is not a policy room
return !isUserCreatedPolicyRoom(report) && _.isEqual(participantsLoginList, _.sortBy(report.participants));
});
}

/**
* Attempts to find a report in onyx with the provided list of participants in given policy
* @param {Array} newParticipantList
Expand Down Expand Up @@ -3631,7 +3609,6 @@ export {
getOptimisticDataForParentReportAction,
shouldReportBeInOptionList,
getChatByParticipants,
getChatByParticipantsByLoginList,
getChatByParticipantsAndPolicy,
getAllPolicyReports,
getIOUReportActionMessage,
Expand Down
8 changes: 4 additions & 4 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import * as ErrorUtils from '../ErrorUtils';
import * as UserUtils from '../UserUtils';
import * as Welcome from './Welcome';
import * as PersonalDetailsUtils from '../PersonalDetailsUtils';
import * as OptionsListUtils from '../OptionsListUtils';
import * as Environment from '../Environment/Environment';
import * as Session from './Session';

Expand Down Expand Up @@ -559,10 +558,11 @@ function openReport(reportID, participantLoginList = [], newReportObject = {}, p
*/
function navigateToAndOpenReport(userLogins, shouldDismissModal = true) {
let newChat = {};
const formattedUserLogins = _.map(userLogins, (login) => OptionsListUtils.addSMSDomainIfPhoneNumber(login).toLowerCase());
const chat = ReportUtils.getChatByParticipantsByLoginList(formattedUserLogins);

const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins(userLogins);
const chat = ReportUtils.getChatByParticipants(participantAccountIDs);

if (!chat) {
const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins(userLogins);
newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs);
}
const reportID = chat ? chat.reportID : newChat.reportID;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ function setAssigneeValue(assigneeEmail, assigneeAccountID, shareDestination, is
let chatReport;

if (!isCurrentUser) {
chatReport = ReportUtils.getChatByParticipantsByLoginList([assigneeEmail]) || ReportUtils.getChatByParticipants([assigneeAccountID]);
chatReport = ReportUtils.getChatByParticipants([assigneeAccountID]);
if (!chatReport) {
chatReport = ReportUtils.buildOptimisticChatReport([assigneeAccountID]);
chatReport.isOptimisticReport = true;
Expand Down
Loading