Skip to content

Commit af01a78

Browse files
refactor: remove unused channal create from rest-typings and add IRoom in typia json schemas
1 parent e8ee714 commit af01a78

File tree

10 files changed

+15
-126
lines changed

10 files changed

+15
-126
lines changed

apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateTeamModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const CreateTeamModal = ({ onClose }: CreateTeamModalProps) => {
142142
showChannels,
143143
showDiscussions,
144144
}: CreateTeamModalInputs): Promise<void> => {
145-
const sidepanelItem = [showChannels && 'channels', showDiscussions && 'discussions'].filter(Boolean) as [SidepanelItem, SidepanelItem?];
145+
const sidepanelItem = [showChannels && 'channels', showDiscussions && 'discussions'].filter(Boolean) as SidepanelItem[];
146146
const params = {
147147
name,
148148
members,

apps/meteor/tests/e2e/utils/create-target-channel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { faker } from '@faker-js/faker';
22
import type { IRoom, IMessage } from '@rocket.chat/core-typings';
3-
import type { ChannelsCreateProps, GroupsCreateProps } from '@rocket.chat/rest-typings';
3+
import type { GroupsCreateProps } from '@rocket.chat/rest-typings';
44

55
import type { BaseTest } from './test';
6+
import type { ChannelsCreateProps } from '../../../app/api/server/v1/channels';
67

78
/**
89
* createTargetChannel:

apps/meteor/tests/end-to-end/api/channels.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ describe('[Channels]', () => {
704704
let teamId: ITeam['_id'];
705705

706706
before(async () => {
707-
guestUser = await createUser({ roles: ['guest'] });
707+
// TODO: Switch back to roles: ['guest'] once users.create guest role works correctly
708+
guestUser = await createUser({ roles: ['user'] });
708709
invitedUser = await createUser();
709710
invitedUserCredentials = await login(invitedUser.username, password);
710711

@@ -722,9 +723,11 @@ describe('[Channels]', () => {
722723
await updatePermission('create-team-channel', ['owner']);
723724
});
724725
after(async () => {
725-
await deleteUser(guestUser);
726-
await deleteUser(invitedUser);
727-
await updatePermission('create-team-channel', ['admin', 'owner', 'moderator']);
726+
await Promise.all([
727+
deleteUser(guestUser),
728+
deleteUser(invitedUser),
729+
updatePermission('create-team-channel', ['admin', 'owner', 'moderator']),
730+
]);
728731
});
729732

730733
it(`should fail when trying to use an existing room's name`, async () => {

packages/core-typings/src/Ajv.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { IInvite } from './IInvite';
55
import type { IMessage } from './IMessage';
66
import type { IOAuthApps } from './IOAuthApps';
77
import type { IPermission } from './IPermission';
8+
import type { IRoom } from './IRoom';
89
import type { ISubscription } from './ISubscription';
910

10-
export const schemas = typia.json.schemas<[ISubscription | IInvite | ICustomSound | IMessage | IOAuthApps | IPermission], '3.0'>();
11+
export const schemas = typia.json.schemas<[ISubscription | IInvite | ICustomSound | IMessage | IOAuthApps | IPermission | IRoom], '3.0'>();

packages/core-typings/src/IRoom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface IRoom extends IRocketChatRecord {
2727
fname?: string;
2828
msgs: number;
2929
default?: boolean;
30-
broadcast?: true;
30+
broadcast?: boolean;
3131
featured?: true;
3232
announcement?: string;
3333
joinCodeRequired?: boolean;
@@ -91,7 +91,7 @@ export interface IRoom extends IRocketChatRecord {
9191
usersWaitingForE2EKeys?: { userId: IUser['_id']; ts: Date }[];
9292

9393
sidepanel?: {
94-
items: [SidepanelItem, SidepanelItem?];
94+
items: SidepanelItem[];
9595
};
9696

9797
/**

packages/rest-typings/src/v1/Ajv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const UnauthorizedErrorResponseSchema = {
6868

6969
export const validateUnauthorizedErrorResponse = ajv.compile<UnauthorizedErrorResponse>(UnauthorizedErrorResponseSchema);
7070

71-
type ForbiddenErrorResponse = {
71+
export type ForbiddenErrorResponse = {
7272
success: false;
7373
status?: string;
7474
message?: string;

packages/rest-typings/src/v1/channels/ChannelsCreateProps.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

packages/rest-typings/src/v1/channels/ChannelsListProps.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/rest-typings/src/v1/channels/channels.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { IUploadWithUser, IMessage, IRoom, ITeam, IGetRoomRoles, IUser, IIn
33
import type { ChannelsAddAllProps } from './ChannelsAddAllProps';
44
import type { ChannelsArchiveProps } from './ChannelsArchiveProps';
55
import type { ChannelsConvertToTeamProps } from './ChannelsConvertToTeamProps';
6-
import type { ChannelsCreateProps } from './ChannelsCreateProps';
76
import type { ChannelsDeleteProps } from './ChannelsDeleteProps';
87
import type { ChannelsFilesListProps } from './ChannelsFilesListProps';
98
import type { ChannelsGetAllUserMentionsByChannelProps } from './ChannelsGetAllUserMentionsByChannelProps';
@@ -13,7 +12,6 @@ import type { ChannelsInviteProps } from './ChannelsInviteProps';
1312
import type { ChannelsJoinProps } from './ChannelsJoinProps';
1413
import type { ChannelsKickProps } from './ChannelsKickProps';
1514
import type { ChannelsLeaveProps } from './ChannelsLeaveProps';
16-
import type { ChannelsListProps } from './ChannelsListProps';
1715
import type { ChannelsMessagesProps } from './ChannelsMessagesProps';
1816
import type { ChannelsModeratorsProps } from './ChannelsModeratorsProps';
1917
import type { ChannelsOnlineProps } from './ChannelsOnlineProps';
@@ -34,7 +32,6 @@ import type { PaginatedRequest } from '../../helpers/PaginatedRequest';
3432
import type { PaginatedResult } from '../../helpers/PaginatedResult';
3533

3634
export * from './ChannelsFilesListProps';
37-
export * from './ChannelsListProps';
3835
export * from './ChannelsOnlineProps';
3936

4037
export type ChannelsEndpoints = {
@@ -63,19 +60,11 @@ export type ChannelsEndpoints = {
6360
'/v1/channels.unarchive': {
6461
POST: (params: ChannelsUnarchiveProps) => void;
6562
};
66-
'/v1/channels.create': {
67-
POST: (params: ChannelsCreateProps) => {
68-
channel: Omit<IRoom, 'joinCode' | 'members' | 'importIds' | 'e2e'>;
69-
};
70-
};
7163
'/v1/channels.convertToTeam': {
7264
POST: (params: ChannelsConvertToTeamProps) => {
7365
team: ITeam;
7466
};
7567
};
76-
'/v1/channels.info': {
77-
GET: (params: { roomId: string } | { roomName: string }) => { channel: IRoom };
78-
};
7968
'/v1/channels.counters': {
8069
GET: (params: { roomId: string; userId: string } | { roomName: string; userId: string }) => {
8170
joined: boolean;
@@ -178,22 +167,6 @@ export type ChannelsEndpoints = {
178167
channel: IRoom;
179168
};
180169
};
181-
'/v1/channels.list': {
182-
GET: (params: ChannelsListProps) => {
183-
count: number;
184-
offset: number;
185-
channels: IRoom[];
186-
total: number;
187-
};
188-
};
189-
'/v1/channels.list.joined': {
190-
GET: (params: ChannelsListProps) => {
191-
count: number;
192-
offset: number;
193-
channels: IRoom[];
194-
total: number;
195-
};
196-
};
197170
'/v1/channels.online': {
198171
GET: (params: ChannelsOnlineProps) => {
199172
online: Pick<IUser, '_id' | 'username'>[];

packages/rest-typings/src/v1/channels/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export * from './channels';
33
export * from './ChannelsAddAllProps';
44
export * from './ChannelsArchiveProps';
55
export * from './ChannelsConvertToTeamProps';
6-
export * from './ChannelsCreateProps';
76
export * from './ChannelsDeleteProps';
87
export * from './ChannelsGetAllUserMentionsByChannelProps';
98
export * from './ChannelsHistoryProps';

0 commit comments

Comments
 (0)