@@ -240,17 +240,11 @@ const dmOpenEndpointsProps = {
240240 additionalProperties : false ,
241241 } ) ,
242242 } ,
243- } ;
243+ } as const ;
244244
245245const dmOpenAction = < Path extends string > ( _path : Path ) : TypedAction < typeof dmOpenEndpointsProps , Path > =>
246246 async function action ( ) {
247247 const { roomId } = this . bodyParams ;
248- if ( ! roomId ) {
249- throw new Meteor . Error ( 'error-room-param-not-provided' , 'Body param "roomId" is required' ) ;
250- }
251- if ( ! this . userId ) {
252- throw new Meteor . Error ( 'error-invalid-user' , 'Invalid user' ) ;
253- }
254248 const canAccess = await canAccessRoomIdAsync ( roomId , this . userId ) ;
255249 if ( ! canAccess ) {
256250 return API . v1 . forbidden ( 'error-not-allowed' ) ;
@@ -661,7 +655,7 @@ const dmMessagesAction = <Path extends string>(_path: Path): TypedAction<typeof
661655 ...query ,
662656 ...parseIds ( mentionIds , 'mentions._id' ) ,
663657 ...parseIds ( starredIds , 'starred._id' ) ,
664- ...( pinned && pinned . toLowerCase ( ) === 'true' ? { pinned : true } : { } ) ,
658+ ...( pinned ? .toLowerCase ( ) === 'true' && { pinned : true } ) ,
665659 _hidden : { $ne : true } ,
666660 } ;
667661 const sortObj = sort || { ts : - 1 } ;
@@ -931,7 +925,6 @@ API.v1.addRoute(
931925 } ,
932926) ;
933927
934-
935928export type DmEndpoints = ExtractRoutesFromAPI < typeof dmEndpoints > ;
936929
937930declare module '@rocket.chat/rest-typings' {
0 commit comments