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

UI for room invitations/removals #27966

Merged
merged 103 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
8217aa5
make room change logs render with muted text, rename muted text => al…
jasperhuangg Sep 20, 2023
7f46411
style
jasperhuangg Sep 20, 2023
c7c6806
replace baseURLs in policy change logs
jasperhuangg Sep 20, 2023
0ca3c28
get environment URL correctly
jasperhuangg Sep 20, 2023
edf6e3e
style
jasperhuangg Sep 20, 2023
08916dc
setup navigation
jasperhuangg Sep 21, 2023
0f9bfb1
setup navigation
jasperhuangg Sep 21, 2023
df867f7
setup RoomMembersPage skeleton
jasperhuangg Sep 21, 2023
99f89fe
working RoomMembersPage
jasperhuangg Sep 21, 2023
f76b532
whitespace
jasperhuangg Sep 21, 2023
1cd91b8
setup navigation for room invite page
jasperhuangg Sep 21, 2023
6d66514
room invite page skeleton
jasperhuangg Sep 21, 2023
3958169
wip RoomInvitePage
jasperhuangg Sep 21, 2023
58a5ec9
wip
jasperhuangg Sep 25, 2023
be1b895
add JS doc
jasperhuangg Sep 25, 2023
8c76198
use correct import syntax
jasperhuangg Sep 25, 2023
44ed0ee
Style"
jasperhuangg Sep 25, 2023
8019cd1
remove unused
jasperhuangg Sep 25, 2023
53e45de
remove unused
jasperhuangg Sep 25, 2023
1afb3dd
fix conflicts
jasperhuangg Sep 25, 2023
23d3b07
fix routes
jasperhuangg Sep 25, 2023
5aa4a34
fix syntax error
jasperhuangg Sep 25, 2023
e52df68
fix warnings
jasperhuangg Sep 25, 2023
3f241d9
fix warnings
jasperhuangg Sep 25, 2023
1306381
finish setting up invitations
jasperhuangg Sep 25, 2023
a1d00f7
call OpenRoomMembersPage
jasperhuangg Sep 25, 2023
b7f927b
remove unused
jasperhuangg Sep 25, 2023
77131d9
remove unused
jasperhuangg Sep 25, 2023
4f2ad0d
call OpenRoomMembersPage
jasperhuangg Sep 25, 2023
e52b89d
style
jasperhuangg Sep 25, 2023
b277622
update translations
jasperhuangg Sep 25, 2023
2e65408
update spanish translations
jasperhuangg Sep 25, 2023
652316e
remove unused
jasperhuangg Sep 25, 2023
e1dcae3
remove unused
jasperhuangg Sep 25, 2023
339e80d
fix translation
jasperhuangg Sep 25, 2023
f9e0d88
wip
jasperhuangg Sep 26, 2023
c129c76
Merge branch 'main' of github.com:Expensify/App into jasper-roomChang…
jasperhuangg Sep 26, 2023
ad6c088
pull room change logs
jasperhuangg Sep 26, 2023
e54533c
fix linter errors
jasperhuangg Sep 26, 2023
16eff1b
remove unused
jasperhuangg Sep 26, 2023
2b45642
add missing import
jasperhuangg Sep 26, 2023
15d7991
pass email
jasperhuangg Sep 26, 2023
53306f7
update const name
jasperhuangg Sep 26, 2023
5c1a87e
use reportLostAccess flag
jasperhuangg Sep 26, 2023
829fd84
use inviteeEmails
jasperhuangg Sep 26, 2023
38cee0a
pass login instead of email
jasperhuangg Sep 26, 2023
2276bcb
ensure participants are updated optimistically
jasperhuangg Sep 26, 2023
5dc91a1
show all types of UCRs in the LHN even if there aren't any participants
jasperhuangg Sep 26, 2023
cb2fabc
style
jasperhuangg Sep 26, 2023
2d157de
wip
jasperhuangg Sep 27, 2023
1aba445
add policyRooms beta checks for any features that use reliable update…
jasperhuangg Sep 28, 2023
5ad7988
fix imports
jasperhuangg Sep 28, 2023
b4e3b49
wip
jasperhuangg Oct 9, 2023
c4338b0
remove unused, update translations
jasperhuangg Oct 12, 2023
5b3a459
remove unused, ensure leaving workspace rooms as workspace member works
jasperhuangg Oct 12, 2023
ddb6095
correctly set leave room optimistic data when leaving a report
jasperhuangg Oct 12, 2023
0b35a99
correctly set leave room optimistic data when leaving a report
jasperhuangg Oct 12, 2023
bcba213
resolve conflicts with main
jasperhuangg Oct 12, 2023
3d496a4
remove unused:
jasperhuangg Oct 12, 2023
0617f2b
remove unused
jasperhuangg Oct 12, 2023
cbc77d6
remove unused
jasperhuangg Oct 12, 2023
340ae6b
remove unused
jasperhuangg Oct 12, 2023
4af9a7a
add missing import
jasperhuangg Oct 12, 2023
3f6eb67
fix room name not displaying
jasperhuangg Oct 12, 2023
8eb0225
merge conflicts
jasperhuangg Oct 16, 2023
63c48f5
fixes to sidebar utils logic
jasperhuangg Oct 17, 2023
9bec905
fix displaying avatars
jasperhuangg Oct 17, 2023
06ef3c3
ensure expensify emails don't appear in room invite page
jasperhuangg Oct 17, 2023
2e6af01
use utility function to get ReportName`
jasperhuangg Oct 17, 2023
e4cc7b4
style
jasperhuangg Oct 17, 2023
c5d0c71
remove unused
jasperhuangg Oct 17, 2023
b2ead0b
remove unused
jasperhuangg Oct 17, 2023
57d1638
merge main
jasperhuangg Oct 17, 2023
0f8ddc3
merge main
jasperhuangg Oct 17, 2023
fa42b03
resolve merge conflicts with main
jasperhuangg Oct 17, 2023
b9653f2
remove unused
jasperhuangg Oct 17, 2023
cced4f4
remove unused
jasperhuangg Oct 17, 2023
d94ed73
Update src/libs/PolicyUtils.js
jasperhuangg Oct 17, 2023
25a7f46
Merge branch 'jasper-uiForRoomInvitations/Removals' of github.com:Exp…
jasperhuangg Oct 17, 2023
8393377
Update src/libs/SidebarUtils.js
jasperhuangg Oct 17, 2023
38a1ab9
Update src/libs/actions/Report.js
jasperhuangg Oct 17, 2023
1ebc601
Update src/pages/ReportDetailsPage.js
jasperhuangg Oct 17, 2023
86f9421
fix review comments
jasperhuangg Oct 17, 2023
d6cbfbb
simplify condition
jasperhuangg Oct 18, 2023
c85fb75
simplify logic
jasperhuangg Oct 18, 2023
24f2522
remove unused
jasperhuangg Oct 18, 2023
c862a6a
review comments
jasperhuangg Oct 18, 2023
13b05d4
style
jasperhuangg Oct 18, 2023
b347b78
remove unused
jasperhuangg Oct 18, 2023
7953984
remove unused
jasperhuangg Oct 18, 2023
5e10326
review changes for RoomInvitePage
jasperhuangg Oct 18, 2023
6b58fcc
review comments from RoomMembersPage
jasperhuangg Oct 18, 2023
fec6da3
review comments
jasperhuangg Oct 18, 2023
64001cb
fix bug where skeleton loader shows incorrectly
jasperhuangg Oct 18, 2023
f024ccb
style
jasperhuangg Oct 18, 2023
8b3b0db
resolve merge conflicts
jasperhuangg Oct 18, 2023
10f0383
use merge
jasperhuangg Oct 18, 2023
8f1622b
remove unused
jasperhuangg Oct 18, 2023
b0e7b1d
add success data to remove from room
jasperhuangg Oct 18, 2023
9c4879e
ensure room change logs are supported
jasperhuangg Oct 18, 2023
08a8a58
remove unused
jasperhuangg Oct 18, 2023
0a19df9
add missing prop
jasperhuangg Oct 18, 2023
5015b1a
style
jasperhuangg Oct 18, 2023
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
8 changes: 8 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ const CONST = {
DELETE_TAG: 'POLICYCHANGELOG_DELETE_TAG',
IMPORT_CUSTOM_UNIT_RATES: 'POLICYCHANGELOG_IMPORT_CUSTOM_UNIT_RATES',
IMPORT_TAGS: 'POLICYCHANGELOG_IMPORT_TAGS',
INVITE_TO_ROOM: 'POLICYCHANGELOG_INVITETOROOM',
REMOVE_FROM_ROOM: 'POLICYCHANGELOG_REMOVEFROMROOM',
SET_AUTOREIMBURSEMENT: 'POLICYCHANGELOG_SET_AUTOREIMBURSEMENT',
SET_AUTO_JOIN: 'POLICYCHANGELOG_SET_AUTO_JOIN',
SET_CATEGORY_NAME: 'POLICYCHANGELOG_SET_CATEGORY_NAME',
Expand Down Expand Up @@ -550,6 +552,11 @@ const CONST = {
UPDATE_TIME_ENABLED: 'POLICYCHANGELOG_UPDATE_TIME_ENABLED',
UPDATE_TIME_RATE: 'POLICYCHANGELOG_UPDATE_TIME_RATE',
},
ROOMCHANGELOG: {
INVITE_TO_ROOM: 'INVITETOROOM',
REMOVE_FROM_ROOM: 'REMOVEFROMROOM',
JOIN_ROOM: 'JOINROOM',
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
ARCHIVE_REASON: {
Expand Down Expand Up @@ -1423,6 +1430,7 @@ const CONST = {
REPORT_DETAILS_MENU_ITEM: {
SHARE_CODE: 'shareCode',
MEMBERS: 'member',
INVITE: 'invite',
SETTINGS: 'settings',
LEAVE_ROOM: 'leaveRoom',
WELCOME_MESSAGE: 'welcomeMessage',
Expand Down
8 changes: 8 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ export default {
route: 'r/:reportID/notes/:accountID/edit',
getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}/edit`,
},
ROOM_MEMBERS: {
route: 'r/:reportID/members',
getRoute: (reportID: string) => `r/${reportID}/members`,
},
ROOM_INVITE: {
route: 'r/:reportID/invite',
getRoute: (reportID: string) => `r/${reportID}/invite`,
},

// To see the available iouType, please refer to CONST.IOU.TYPE
MONEY_REQUEST: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormAlertWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function FormAlertWrapper(props) {
</Text>
);
} else if (props.isMessageHtml) {
children = <RenderHTML html={`<muted-text>${props.message}</muted-text>`} />;
children = <RenderHTML html={`<alert-text>${props.message}</alert-text>`} />;
}
return (
<View style={props.containerStyles}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ const customHTMLElementModels = {
edited: defaultHTMLElementModels.span.extend({
tagName: 'edited',
}),
'alert-text': defaultHTMLElementModels.div.extend({
tagName: 'alert-text',
mixedUAStyles: {...styles.formError, ...styles.mb0},
}),
'muted-text': defaultHTMLElementModels.div.extend({
tagName: 'muted-text',
mixedUAStyles: {...styles.formError, ...styles.mb0},
mixedUAStyles: {...styles.colorMuted, ...styles.mb0},
}),
comment: defaultHTMLElementModels.div.extend({
tagName: 'comment',
Expand Down
11 changes: 8 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import type {
ConfirmThatParams,
UntilTimeParams,
StepCounterParams,
UserIsAlreadyMemberOfWorkspaceParams,
UserIsAlreadyMemberParams,
GoToRoomParams,
WelcomeNoteParams,
RoomNameReservedErrorParams,
Expand Down Expand Up @@ -1200,7 +1200,7 @@ export default {
messages: {
errorMessageInvalidPhone: `Please enter a valid phone number without brackets or dashes. If you're outside the US please include your country code (e.g. ${CONST.EXAMPLE_PHONE_NUMBER}).`,
errorMessageInvalidEmail: 'Invalid email',
userIsAlreadyMemberOfWorkspace: ({login, workspace}: UserIsAlreadyMemberOfWorkspaceParams) => `${login} is already a member of ${workspace}`,
userIsAlreadyMember: ({login, name}: UserIsAlreadyMemberParams) => `${login} is already a member of ${name}`,
},
onfidoStep: {
acceptTerms: 'By continuing with the request to activate your Expensify wallet, you confirm that you have read, understand and accept ',
Expand Down Expand Up @@ -1590,13 +1590,18 @@ export default {
selectAWorkspace: 'Select a workspace',
growlMessageOnRenameError: 'Unable to rename policy room, please check your connection and try again.',
visibilityOptions: {
restricted: 'Restricted',
restricted: 'Workspace', // the translation for "restricted" visibility is actually workspace. This is so we can display restricted visibility rooms as "workspace" without having to change what's stored.
private: 'Private',
public: 'Public',
// eslint-disable-next-line @typescript-eslint/naming-convention
public_announce: 'Public Announce',
},
},
roomMembersPage: {
memberNotFound: 'Member not found. To invite a new member to the room, please use the Invite button above.',
notAuthorized: `You do not have access to this page. Are you trying to join the room? Please reach out to a member of this room so they can add you as a member! Something else? Reach out to ${CONST.EMAIL.CONCIERGE}`,
removeMembersPrompt: 'Are you sure you want to remove the selected members from the room?',
},
newTaskPage: {
assignTask: 'Assign task',
assignMe: 'Assign to me',
Expand Down
11 changes: 8 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import type {
ConfirmThatParams,
UntilTimeParams,
StepCounterParams,
UserIsAlreadyMemberOfWorkspaceParams,
UserIsAlreadyMemberParams,
GoToRoomParams,
WelcomeNoteParams,
RoomNameReservedErrorParams,
Expand Down Expand Up @@ -1218,7 +1218,7 @@ export default {
messages: {
errorMessageInvalidPhone: `Por favor, introduce un número de teléfono válido sin paréntesis o guiones. Si reside fuera de Estados Unidos, por favor incluye el prefijo internacional (p. ej. ${CONST.EXAMPLE_PHONE_NUMBER}).`,
errorMessageInvalidEmail: 'Email inválido',
userIsAlreadyMemberOfWorkspace: ({login, workspace}: UserIsAlreadyMemberOfWorkspaceParams) => `${login} ya es miembro de ${workspace}`,
userIsAlreadyMember: ({login, name}: UserIsAlreadyMemberParams) => `${login} ya es miembro de ${name}`,
},
onfidoStep: {
acceptTerms: 'Al continuar con la solicitud para activar su billetera Expensify, confirma que ha leído, comprende y acepta ',
Expand Down Expand Up @@ -1614,13 +1614,18 @@ export default {
selectAWorkspace: 'Seleccionar un espacio de trabajo',
growlMessageOnRenameError: 'No se ha podido cambiar el nombre del espacio de trabajo, por favor, comprueba tu conexión e inténtalo de nuevo.',
visibilityOptions: {
restricted: 'Restringida',
restricted: 'Espacio de trabajo', // the translation for "restricted" visibility is actually workspace. This is so we can display restricted visibility rooms as "workspace" without having to change what's stored.
private: 'Privada',
public: 'Público',
// eslint-disable-next-line @typescript-eslint/naming-convention
public_announce: 'Anuncio Público',
},
},
roomMembersPage: {
memberNotFound: 'Miembro no encontrado. Para invitar a un nuevo miembro a la sala de chat, por favor, utiliza el botón Invitar que está más arriba.',
notAuthorized: `No tienes acceso a esta página. ¿Estás tratando de unirte a la sala de chat? Comunícate con el propietario de esta sala de chat para que pueda añadirte como miembro. ¿Necesitas algo más? Comunícate con ${CONST.EMAIL.CONCIERGE}`,
removeMembersPrompt: '¿Estás seguro de que quieres eliminar a los miembros seleccionados de la sala de chat?',
},
newTaskPage: {
assignTask: 'Asignar tarea',
assignMe: 'Asignar a mí mismo',
Expand Down
4 changes: 2 additions & 2 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ type UntilTimeParams = {time: string};

type StepCounterParams = {step: number; total?: number; text?: string};

type UserIsAlreadyMemberOfWorkspaceParams = {login: string; workspace: string};
type UserIsAlreadyMemberParams = {login: string; name: string};

type GoToRoomParams = {roomName: string};

Expand Down Expand Up @@ -303,7 +303,7 @@ export type {
ConfirmThatParams,
UntilTimeParams,
StepCounterParams,
UserIsAlreadyMemberOfWorkspaceParams,
UserIsAlreadyMemberParams,
GoToRoomParams,
WelcomeNoteParams,
RoomNameReservedErrorParams,
Expand Down
10 changes: 10 additions & 0 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ const ReportParticipantsModalStackNavigator = createModalStackNavigator({
ReportParticipants_Root: () => require('../../../pages/ReportParticipantsPage').default,
});

const RoomMembersModalStackNavigator = createModalStackNavigator({
RoomMembers_Root: () => require('../../../pages/RoomMembersPage').default,
});

const RoomInviteModalStackNavigator = createModalStackNavigator({
RoomInvite_Root: () => require('../../../pages/RoomInvitePage').default,
});

const SearchModalStackNavigator = createModalStackNavigator({
Search_Root: () => require('../../../pages/SearchPage').default,
});
Expand Down Expand Up @@ -231,4 +239,6 @@ export {
PrivateNotesModalStackNavigator,
NewTeachersUniteNavigator,
SignInModalStackNavigator,
RoomMembersModalStackNavigator,
RoomInviteModalStackNavigator,
};
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ function RightModalNavigator(props) {
name="Participants"
component={ModalStackNavigators.ReportParticipantsModalStackNavigator}
/>
<Stack.Screen
name="RoomMembers"
component={ModalStackNavigators.RoomMembersModalStackNavigator}
/>
<Stack.Screen
name="RoomInvite"
component={ModalStackNavigators.RoomInviteModalStackNavigator}
/>
<Stack.Screen
name="MoneyRequest"
component={ModalStackNavigators.MoneyRequestModalStackNavigator}
Expand Down
10 changes: 10 additions & 0 deletions src/libs/Navigation/linkingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ export default {
ReportParticipants_Root: ROUTES.REPORT_PARTICIPANTS.route,
},
},
RoomInvite: {
screens: {
RoomInvite_Root: ROUTES.ROOM_INVITE.route,
},
},
RoomMembers: {
screens: {
RoomMembers_Root: ROUTES.ROOM_MEMBERS.route,
},
},
MoneyRequest: {
screens: {
Money_Request: {
Expand Down
9 changes: 9 additions & 0 deletions src/libs/PolicyUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ function isExpensifyGuideTeam(email) {
*/
const isPolicyAdmin = (policy) => lodashGet(policy, 'role') === CONST.POLICY.ROLE.ADMIN;

/**
*
* @param {String} policyID
* @param {Object} policies
* @returns {Boolean}
*/
const isPolicyMember = (policyID, policies) => _.some(policies, (policy) => policy.id === policyID);
Copy link
Contributor

Choose a reason for hiding this comment

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

This caused a crash #30078 when deleting a workspace, the policy will be null. We should have included safety checks for the policy.


/**
* @param {Object} policyMembers
* @param {Object} personalDetails
Expand Down Expand Up @@ -276,6 +284,7 @@ export {
isPolicyAdmin,
getMemberAccountIDsForWorkspace,
getIneligibleInvitees,
isPolicyMember,
getTag,
getTagListName,
getTagList,
Expand Down
40 changes: 37 additions & 3 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {isEqual, max, parseISO} from 'date-fns';
import _ from 'lodash';
import lodashFindLast from 'lodash/findLast';
import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import {ValueOf} from 'type-fest';
Expand All @@ -10,6 +11,7 @@ import {ActionName} from '../types/onyx/OriginalMessage';
import * as CollectionUtils from './CollectionUtils';
import Log from './Log';
import isReportMessageAttachment from './isReportMessageAttachment';
import * as Environment from './Environment/Environment';

type LastVisibleMessage = {
lastMessageTranslationKey?: string;
Expand Down Expand Up @@ -49,6 +51,9 @@ Onyx.connect({
callback: (val) => (isNetworkOffline = val?.isOffline ?? false),
});

let environmentURL: string;
Environment.getEnvironmentURL().then((url: string) => (environmentURL = url));

function isCreatedAction(reportAction: OnyxEntry<ReportAction>): boolean {
return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED;
}
Expand Down Expand Up @@ -288,8 +293,8 @@ function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key:
return false;
}

const {POLICYCHANGELOG: policyChangelogTypes, ...otherActionTypes} = CONST.REPORT.ACTIONS.TYPE;
const supportedActionTypes: ActionName[] = [...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes)];
const {POLICYCHANGELOG: policyChangelogTypes, ROOMCHANGELOG: roomChangeLogTypes, ...otherActionTypes} = CONST.REPORT.ACTIONS.TYPE;
const supportedActionTypes: ActionName[] = [...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes), ...Object.values(roomChangeLogTypes)];

// Filter out any unsupported reportAction types
if (!supportedActionTypes.includes(reportAction.actionName)) {
Expand Down Expand Up @@ -333,6 +338,34 @@ function shouldReportActionBeVisibleAsLastAction(reportAction: OnyxEntry<ReportA
);
}

/**
* For invite to room and remove from room policy change logs, report URLs are generated in the server,
* which includes a baseURL placeholder that's replaced in the client.
*/
function replaceBaseURL(reportAction: ReportAction): ReportAction {
if (!reportAction) {
return reportAction;
}

if (
!reportAction ||
(reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.INVITE_TO_ROOM && reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.REMOVE_FROM_ROOM)
) {
return reportAction;
}
if (!reportAction.message) {
return reportAction;
}
const updatedReportAction = _.clone(reportAction);
if (!updatedReportAction.message) {
return updatedReportAction;
}
updatedReportAction.message[0].html = reportAction.message[0].html.replace('%baseURL', environmentURL);
return updatedReportAction;
}

/**
*/
function getLastVisibleAction(reportID: string, actionsToMerge: ReportActions = {}): OnyxEntry<ReportAction> {
const updatedActionsToMerge: ReportActions = {};
if (actionsToMerge && Object.keys(actionsToMerge).length !== 0) {
Expand Down Expand Up @@ -397,7 +430,8 @@ function getSortedReportActionsForDisplay(reportActions: ReportActions | null):
const filteredReportActions = Object.entries(reportActions ?? {})
.filter(([key, reportAction]) => shouldReportActionBeVisible(reportAction, key))
.map((entry) => entry[1]);
return getSortedReportActions(filteredReportActions, true);
const baseURLAdjustedReportActions = filteredReportActions.map((reportAction) => replaceBaseURL(reportAction));
return getSortedReportActions(baseURLAdjustedReportActions, true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3156,7 +3156,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas,
(report.participantAccountIDs &&
report.participantAccountIDs.length === 0 &&
!isChatThread(report) &&
!isPublicRoom(report) &&
!isUserCreatedPolicyRoom(report) &&
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
!isArchivedRoom(report) &&
!isMoneyRequestReport(report) &&
!isTaskReport(report))
Expand Down
28 changes: 28 additions & 0 deletions src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,34 @@ function getOptionData(report, reportActions, personalDetails, preferredLocale,
result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.reopened')}`;
} else if (lastAction && lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED) {
result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.completed')}`;
} else if (
lastAction &&
_.includes(
[
CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM,
CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.REMOVE_FROM_ROOM,
CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.INVITE_TO_ROOM,
CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.REMOVE_FROM_ROOM,
],
lastAction.actionName,
)
) {
const targetAccountIDs = lodashGet(lastAction, 'originalMessage.targetAccountIDs', []);
const verb =
lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM || lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.INVITE_TO_ROOM
? 'invited'
: 'removed';
const users = targetAccountIDs.length > 1 ? 'users' : 'user';
result.alternateText = `${verb} ${targetAccountIDs.length} ${users}`;

const roomName = lodashGet(lastAction, 'originalMessage.roomName', '');
if (roomName) {
const preposition =
lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM || lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.INVITE_TO_ROOM
? ' to'
: ' from';
result.alternateText += `${preposition} ${roomName}`;
}
} else if (lastAction && lastAction.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && lastActorDisplayName && lastMessageTextFromReport) {
result.alternateText = `${lastActorDisplayName}: ${lastMessageText}`;
} else {
Expand Down
Loading
Loading