@@ -312,13 +312,19 @@ public async Task<ActionResult<SendMessageResult>> SendMessage([FromBody] NewMes
312312// Add all the explict people
313313foreach ( var person in newMessageInput . Recipients . Where ( x=> x . Type == 1 ) )
314314{
315- if ( usersToSendTo . All ( x => x != person . Id ) && person . Id != UserId )
315+ if ( ! String . IsNullOrWhiteSpace ( person . Id ) )
316316{
317- // Ensure the user is in the same department
318- if ( departmentUsers . Any ( x=> x . UserId == person . Id ) )
317+ // New RN Apps add a prefix to ID's from the Recipients list, guard against the prefix here.
318+ var userIdToSendTo = person . Id . Replace ( "P:" , "" ) . Trim ( ) ;
319+
320+ if ( usersToSendTo . All ( x=> x != userIdToSendTo ) && userIdToSendTo != UserId )
319321{
320- usersToSendTo . Add ( person . Id ) ;
321- message . AddRecipient ( person . Id ) ;
322+ // Ensure the user is in the same department
323+ if ( departmentUsers . Any ( x=> x . UserId == userIdToSendTo ) )
324+ {
325+ usersToSendTo . Add ( userIdToSendTo ) ;
326+ message . AddRecipient ( userIdToSendTo ) ;
327+ }
322328}
323329}
324330}
@@ -328,8 +334,11 @@ public async Task<ActionResult<SendMessageResult>> SendMessage([FromBody] NewMes
328334{
329335if ( ! String . IsNullOrWhiteSpace ( group . Id ) )
330336{
337+ // New RN Apps add a prefix to ID's from the Recipients list, guard against the prefix here.
338+ var groupIdToSendTo = group . Id . Replace ( "G:" , "" ) . Trim ( ) ;
339+
331340int groupId = 0 ;
332- if ( int . TryParse ( group . Id . Trim ( ) , out groupId ) )
341+ if ( int . TryParse ( groupIdToSendTo , out groupId ) )
333342{
334343if ( departmentGroups . Any ( x=> x . DepartmentGroupId == groupId ) )
335344{
@@ -356,8 +365,11 @@ public async Task<ActionResult<SendMessageResult>> SendMessage([FromBody] NewMes
356365{
357366if ( ! String . IsNullOrWhiteSpace ( role . Id ) )
358367{
368+ // New RN Apps add a prefix to ID's from the Recipients list, guard against the prefix here.
369+ var roleIdToSendTo = role . Id . Replace ( "R:" , "" ) . Trim ( ) ;
370+
359371int roleId = 0 ;
360- if ( int . TryParse ( role . Id . Trim ( ) , out roleId ) )
372+ if ( int . TryParse ( roleIdToSendTo , out roleId ) )
361373{
362374if ( departmentRoles . Any ( x=> x . PersonnelRoleId == roleId ) )
363375{