Skip to content

Commit ade7407

Browse files
authored
Merge pull request Expensify#68385 from mkzie2/mkzie2-issue/67833
feat: pin new admin room by default
2 parents 968edf1 + 7d4bfd0 commit ade7407

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/libs/ReportUtils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7175,6 +7175,7 @@ type BuildOptimisticChatReportParams = {
71757175
description?: string;
71767176
avatarUrl?: string;
71777177
optimisticReportID?: string;
7178+
isPinned?: boolean;
71787179
};
71797180

71807181
function buildOptimisticChatReport({
@@ -7193,6 +7194,7 @@ function buildOptimisticChatReport({
71937194
description = '',
71947195
avatarUrl = '',
71957196
optimisticReportID = '',
7197+
isPinned = false,
71967198
}: BuildOptimisticChatReportParams): OptimisticChatReport {
71977199
const isWorkspaceChatType = chatType && isWorkspaceChat(chatType);
71987200
const participants = participantList.reduce((reportParticipants: Participants, accountID: number) => {
@@ -7209,7 +7211,7 @@ function buildOptimisticChatReport({
72097211
type: CONST.REPORT.TYPE.CHAT,
72107212
chatType,
72117213
isOwnPolicyExpenseChat,
7212-
isPinned: false,
7214+
isPinned,
72137215
lastActorAccountID: 0,
72147216
lastMessageHtml: '',
72157217
lastMessageText: undefined,
@@ -7869,6 +7871,10 @@ function buildOptimisticAnnounceChat(policyID: string, accountIDs: number[]): Op
78697871
};
78707872
}
78717873

7874+
function shouldPinAdminRoomByDefault() {
7875+
return !isExpensifyTeam(currentUserEmail);
7876+
}
7877+
78727878
function buildOptimisticWorkspaceChats(policyID: string, policyName: string, expenseReportId?: string): OptimisticWorkspaceChats {
78737879
const pendingChatMembers = getPendingChatMembers(currentUserAccountID ? [currentUserAccountID] : [], [], CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);
78747880
const adminsChatData = {
@@ -7879,6 +7885,7 @@ function buildOptimisticWorkspaceChats(policyID: string, policyName: string, exp
78797885
policyID,
78807886
ownerAccountID: CONST.POLICY.OWNER_ACCOUNT_ID_FAKE,
78817887
oldPolicyName: policyName,
7888+
isPinned: shouldPinAdminRoomByDefault(),
78827889
}),
78837890
};
78847891
const adminsChatReportID = adminsChatData.reportID;

0 commit comments

Comments
 (0)