@@ -18,7 +18,7 @@ import {
1818 replyToMessageInThread ,
1919 sendMessage
2020} from '../integrations/slack' ;
21- import { getUserFullName , getUserSlackId } from './users.utils' ;
21+ import { getUserSlackId , getUserSlackMentionOrName } from './users.utils' ;
2222import prisma from '../prisma/prisma' ;
2323import { HttpException } from './errors.utils' ;
2424import { Change_Request , Design_Review , Team , WBS_Element } from '@prisma/client' ;
@@ -38,7 +38,7 @@ interface SlackMessageThread {
3838 changeRequestId : string | null ;
3939}
4040
41- const DEV_TESTING_OVERRIDE = false ;
41+ const DEV_TESTING_OVERRIDE = true ;
4242
4343// build the "due" string for the upcoming deadlines slack message
4444export const buildDueString = ( daysUntilDeadline : number ) : string => {
@@ -137,7 +137,7 @@ export const sendReimbursementRequestCreatedNotificationAndCreateMessageInfo = a
137137) : Promise < void > => {
138138 if ( process . env . NODE_ENV !== 'production' && ! DEV_TESTING_OVERRIDE ) return ; // don't send msgs unless in prod
139139
140- const msg = `${ await getUserFullName ( submitterId ) } created a reimbursement request (ID#: ${ requestIdentifier } ) 💲` ;
140+ const msg = `${ await getUserSlackMentionOrName ( submitterId ) } created a reimbursement request (ID#: ${ requestIdentifier } ) 💲` ;
141141 const link = `https://finishlinebyner.com/finance/reimbursement-requests/${ requestId } ` ;
142142 const linkButtonText = 'View Reimbursement Request' ;
143143
@@ -203,24 +203,35 @@ export const sendThreadResponse = async (threads: SlackMessageThread[], message:
203203export const sendReimbursementRequestPendingFinanceNotification = async ( threads : SlackMessageThread [ ] ) =>
204204 await sendThreadResponse ( threads , `This Reimbursement Request is now pending finance :moneybag:` ) ;
205205
206- export const sendReimbursementRequestLeadershipApprovedNotification = async ( threads : SlackMessageThread [ ] ) =>
206+ export const sendReimbursementRequestLeadershipApprovedNotification = async (
207+ threads : SlackMessageThread [ ] ,
208+ approverId : string ,
209+ recipientId : string
210+ ) =>
207211 await sendThreadResponse (
208212 threads ,
209- `This Reimbursment Request has been approved by leadership, you may now purchase the items and add the receipts, then mark the reimbursement request as pending finance.`
213+ `${ await getUserSlackMentionOrName ( approverId ) } has approved this reimbursement request. ${ await getUserSlackMentionOrName ( recipientId ) } you may now purchase the items, add the receipts, and mark the reimbursement request as pending finance.`
210214 ) ;
211215
212- export const sendReimbursementRequestChangesRequestedNotification = async ( threads : SlackMessageThread [ ] ) =>
216+ export const sendReimbursementRequestChangesRequestedNotification = async ( threads : SlackMessageThread [ ] , userId : string ) =>
213217 await sendThreadResponse (
214218 threads ,
215- 'The finance team has requested changes on this reimbursement request, please make the changes and remark as pending finance.'
219+ ` ${ await getUserSlackMentionOrName ( userId ) } has requested changes on this reimbursement request, please make the changes and remark as pending finance.`
216220 ) ;
217221
218222export const sendSubmittedToSaboNotification = async ( threads : SlackMessageThread [ ] ) => {
219223 await sendThreadResponse ( threads , 'This reimbursement request has been submitted to sabo!' ) ;
220224} ;
221225
222- export const sendPendingSaboSubmissionNotification = async ( threads : SlackMessageThread [ ] ) => {
223- await sendThreadResponse ( threads , 'This Reimbursement Request is pending submission to sabo!' ) ;
226+ export const sendPendingSaboSubmissionNotification = async (
227+ threads : SlackMessageThread [ ] ,
228+ financeUserId : string ,
229+ pendingSubmissionFromId : string
230+ ) => {
231+ await sendThreadResponse (
232+ threads ,
233+ `${ await getUserSlackMentionOrName ( financeUserId ) } has added this reimbursement request to Concur. ${ await getUserSlackMentionOrName ( pendingSubmissionFromId ) } , please approve the request in Concur and mark it as submitted on Finishline.`
234+ ) ;
224235} ;
225236
226237export const sendSlackDesignReviewConfirmNotification = async (
0 commit comments