Skip to content

Commit b791446

Browse files
committed
lint
1 parent b91e550 commit b791446

File tree

1 file changed

+2
-9
lines changed
  • apps/meteor/app/api/server/v1

1 file changed

+2
-9
lines changed

apps/meteor/app/api/server/v1/im.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,11 @@ const dmOpenEndpointsProps = {
240240
additionalProperties: false,
241241
}),
242242
},
243-
};
243+
} as const;
244244

245245
const 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-
935928
export type DmEndpoints = ExtractRoutesFromAPI<typeof dmEndpoints>;
936929

937930
declare module '@rocket.chat/rest-typings' {

0 commit comments

Comments
 (0)