@@ -17,7 +17,7 @@ import DistanceRequestUtils from '@libs/DistanceRequestUtils';
1717import { toLocaleDigit } from '@libs/LocaleDigitUtils' ;
1818import { translateLocal } from '@libs/Localize' ;
1919import { rand64 , roundToTwoDecimalPlaces } from '@libs/NumberUtils' ;
20- import { getPersonalDetailByEmail } from '@libs/PersonalDetailsUtils' ;
20+ import { getPersonalDetailsByIDs } from '@libs/PersonalDetailsUtils' ;
2121import {
2222 getCommaSeparatedTagNameWithSanitizedColons ,
2323 getDistanceRateCustomUnitRate ,
@@ -728,7 +728,35 @@ function getMerchantOrDescription(transaction: OnyxEntry<Transaction>) {
728728 * Return the list of modified attendees if present otherwise list of attendees
729729 */
730730function getAttendees ( transaction : OnyxInputOrEntry < Transaction > ) : Attendee [ ] {
731- return transaction ?. modifiedAttendees ? transaction . modifiedAttendees : ( transaction ?. comment ?. attendees ?? [ ] ) ;
731+ const attendees = transaction ?. modifiedAttendees ? transaction . modifiedAttendees : ( transaction ?. comment ?. attendees ?? [ ] ) ;
732+ if ( attendees . length === 0 && transaction ?. reportID ) {
733+ // Get the creator of the transaction by looking at the owner of the report linked to the transaction
734+ const report = getReportOrDraftReport ( transaction . reportID ) ;
735+ const creatorAccountID = report ?. ownerAccountID ;
736+
737+ if ( creatorAccountID ) {
738+ const [ creatorDetails ] = getPersonalDetailsByIDs ( { accountIDs : [ creatorAccountID ] , currentUserAccountID} ) ;
739+ const creatorEmail = creatorDetails ?. login ?? '' ;
740+ const creatorDisplayName = creatorDetails ?. displayName ?? creatorEmail ;
741+
742+ // Check if the creator is already in the attendees list
743+ const isCreatorAlreadyInAttendees = attendees . some ( ( attendee ) => attendee . accountID === creatorAccountID ) ;
744+
745+ if ( ! isCreatorAlreadyInAttendees && creatorEmail ) {
746+ attendees . push ( {
747+ email : creatorEmail ,
748+ login : creatorEmail ,
749+ displayName : creatorDisplayName ,
750+ accountID : creatorAccountID ,
751+ text : creatorDisplayName ,
752+ searchText : creatorDisplayName ,
753+ avatarUrl : creatorDetails ?. avatarThumbnail ?? '' ,
754+ selected : true ,
755+ } ) ;
756+ }
757+ }
758+ }
759+ return attendees ;
732760}
733761
734762/**
0 commit comments