@@ -994,10 +994,10 @@ function updateGroupChatAvatar(reportID: string, file?: File | CustomRNImageMani
994994 * Updates the avatar for a policy room.
995995 */
996996function updatePolicyRoomAvatar ( reportID : string , file ?: File | CustomRNImageManipulatorResult ) {
997- const avatarUrl = file ?. uri ?? '' ;
997+ const avatarURL = file ?. uri ?? '' ;
998998 const { optimisticData, successData, failureData} = buildUpdateReportAvatarOnyxData ( reportID , file ) ;
999999
1000- const optimisticAction = buildOptimisticRoomAvatarUpdatedReportAction ( avatarUrl ) ;
1000+ const optimisticAction = buildOptimisticRoomAvatarUpdatedReportAction ( avatarURL ) ;
10011001 optimisticData . push ( {
10021002 onyxMethod : Onyx . METHOD . MERGE ,
10031003 key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ,
@@ -1011,7 +1011,7 @@ function updatePolicyRoomAvatar(reportID: string, file?: File | CustomRNImageMan
10111011 value : {
10121012 lastActorAccountID : currentUserAccountID ,
10131013 lastVisibleActionCreated : optimisticAction . created ,
1014- lastMessageText : ( optimisticAction ? .message as Message [ ] ) ? .at ( 0 ) ?. text ,
1014+ lastMessageText : ( optimisticAction . message as Message [ ] ) . at ( 0 ) ?. text ,
10151015 } ,
10161016 } ) ;
10171017
@@ -1024,6 +1024,16 @@ function updatePolicyRoomAvatar(reportID: string, file?: File | CustomRNImageMan
10241024 } ,
10251025 } ) ;
10261026
1027+ failureData . push ( {
1028+ onyxMethod : Onyx . METHOD . MERGE ,
1029+ key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ,
1030+ value : {
1031+ [ optimisticAction . reportActionID ] : {
1032+ pendingAction : null ,
1033+ } ,
1034+ } ,
1035+ } ) ;
1036+
10271037 const parameters : UpdateRoomAvatarParams = { reportID, file, reportActionID : optimisticAction . reportActionID } ;
10281038 API . write ( WRITE_COMMANDS . UPDATE_ROOM_AVATAR , parameters , { optimisticData, failureData, successData} ) ;
10291039}
0 commit comments