Skip to content

Commit 0c864e7

Browse files
authored
Merge pull request Expensify#64187 from Expensify/cm-welcome-whisper-action
Create new action for welcome whisper in new expense chat
2 parents 921b603 + f4b67d2 commit 0c864e7

4 files changed

Lines changed: 35 additions & 0 deletions

File tree

src/CONST/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,7 @@ const CONST = {
12831283
ACTIONABLE_MENTION_WHISPER: 'ACTIONABLEMENTIONWHISPER',
12841284
ACTIONABLE_REPORT_MENTION_WHISPER: 'ACTIONABLEREPORTMENTIONWHISPER',
12851285
ACTIONABLE_TRACK_EXPENSE_WHISPER: 'ACTIONABLETRACKEXPENSEWHISPER',
1286+
POLICY_EXPENSE_CHAT_WELCOME_WHISPER: 'POLICYEXPENSECHATWELCOMEWHISPER',
12861287
ADD_COMMENT: 'ADDCOMMENT',
12871288
APPROVED: 'APPROVED',
12881289
CARD_MISSING_ADDRESS: 'CARDMISSINGADDRESS',

src/libs/ReportActionsUtils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,14 @@ function isActionableReportMentionWhisper(reportAction: OnyxEntry<ReportAction>)
741741
return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_REPORT_MENTION_WHISPER);
742742
}
743743

744+
/**
745+
* Checks if a given report action corresponds to a welcome whisper.
746+
* @param reportAction
747+
*/
748+
function isExpenseChatWelcomeWhisper(reportAction: OnyxEntry<ReportAction>): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_EXPENSE_CHAT_WELCOME_WHISPER> {
749+
return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_EXPENSE_CHAT_WELCOME_WHISPER);
750+
}
751+
744752
/**
745753
* Checks whether an action is actionable track expense.
746754
*/
@@ -3002,6 +3010,7 @@ export {
30023010
isActionableMentionWhisper,
30033011
isActionableReportMentionWhisper,
30043012
isActionableTrackExpense,
3013+
isExpenseChatWelcomeWhisper,
30053014
isConciergeCategoryOptions,
30063015
isResolvedConciergeCategoryOptions,
30073016
isAddCommentAction,

src/libs/actions/Policy/Policy.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,16 @@ function createPolicyExpenseChats(policyID: string, invitedEmailsToAccountIDs: I
11731173
chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT,
11741174
policyID,
11751175
ownerAccountID: cleanAccountID,
1176+
notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
11761177
});
1178+
1179+
// Set correct notification preferences: visible for the submitter, hidden for others until there's activity
1180+
if (optimisticReport.participants) {
1181+
optimisticReport.participants[cleanAccountID] = {
1182+
...optimisticReport.participants[cleanAccountID],
1183+
notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS,
1184+
};
1185+
}
11771186
const optimisticCreatedAction = ReportUtils.buildOptimisticCreatedReportAction(login);
11781187

11791188
workspaceMembersChats.reportCreationData[login] = {

src/types/onyx/OriginalMessage.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,21 @@ type OriginalMessageActionableReportMentionWhisper = {
141141
whisperedTo?: number[];
142142
};
143143

144+
/** Model of `welcome whisper` report action */
145+
type OriginalMessagePolicyExpenseChatWelcomeWhisper = {
146+
/** HTML content of the welcome message */
147+
html: string;
148+
149+
/** Collection of accountIDs of users mentioned in message */
150+
whisperedTo?: number[];
151+
152+
/** When was the welcome whisper last modified */
153+
lastModified?: string;
154+
155+
/** Type of whisper (automated) */
156+
type?: string;
157+
};
158+
144159
/** Model of `submitted` report action */
145160
type OriginalMessageSubmitted = {
146161
/** Approved expense amount */
@@ -859,6 +874,7 @@ type OriginalMessageMap = {
859874
[CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_WHISPER]: OriginalMessageActionableMentionWhisper;
860875
[CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_REPORT_MENTION_WHISPER]: OriginalMessageActionableReportMentionWhisper;
861876
[CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_TRACK_EXPENSE_WHISPER]: OriginalMessageActionableTrackedExpenseWhisper;
877+
[CONST.REPORT.ACTIONS.TYPE.POLICY_EXPENSE_CHAT_WELCOME_WHISPER]: OriginalMessagePolicyExpenseChatWelcomeWhisper;
862878
[CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT]: OriginalMessageAddComment;
863879
[CONST.REPORT.ACTIONS.TYPE.APPROVED]: OriginalMessageApproved;
864880
[CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD]: never;

0 commit comments

Comments
 (0)