Skip to content

Commit eeb6850

Browse files
authored
chore: Remove unused room type code (RocketChat#36697)
1 parent 83d558c commit eeb6850

10 files changed

Lines changed: 2 additions & 76 deletions

File tree

apps/meteor/client/lib/rooms/roomCoordinator.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,12 @@ class RoomCoordinatorClient extends RoomCoordinator {
4242
getUiText(_context: ValueOf<typeof UiTextContext>): string {
4343
return '';
4444
},
45-
condition(): boolean {
46-
return true;
47-
},
4845
getAvatarPath(_room): string {
4946
return '';
5047
},
5148
findRoom(_identifier: string): IRoom | undefined {
5249
return undefined;
5350
},
54-
showJoinLink(_roomId: string): boolean {
55-
return false;
56-
},
5751
isLivechatRoom(): boolean {
5852
return false;
5953
},
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { Meteor } from 'meteor/meteor';
2-
3-
import { getUserPreference } from '../../../../app/utils/client';
41
import { getConversationRoomType } from '../../../../lib/rooms/roomTypes/conversation';
52
import { roomCoordinator } from '../roomCoordinator';
63

@@ -11,10 +8,5 @@ roomCoordinator.add(
118
...ConversationRoomType,
129
label: 'Conversations',
1310
},
14-
{
15-
condition(): boolean {
16-
// returns true only if sidebarGroupByType is not set
17-
return !getUserPreference(Meteor.userId(), 'sidebarGroupByType');
18-
},
19-
},
11+
{},
2012
);

apps/meteor/client/lib/rooms/roomTypes/direct.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import type { AtLeast, IRoom } from '@rocket.chat/core-typings';
22
import { isRoomFederated } from '@rocket.chat/core-typings';
33
import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';
4-
import { Meteor } from 'meteor/meteor';
54

6-
import { hasAtLeastOnePermission } from '../../../../app/authorization/client';
75
import { settings } from '../../../../app/settings/client';
8-
import { getUserPreference } from '../../../../app/utils/client';
96
import { getAvatarURL } from '../../../../app/utils/client/getAvatarURL';
107
import { getUserAvatarURL } from '../../../../app/utils/client/getUserAvatarURL';
118
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
@@ -98,11 +95,6 @@ roomCoordinator.add(
9895
}
9996
},
10097

101-
condition() {
102-
const groupByType = getUserPreference(Meteor.userId(), 'sidebarGroupByType');
103-
return groupByType && hasAtLeastOnePermission(['view-d-room', 'view-joined-room']);
104-
},
105-
10698
getAvatarPath(room) {
10799
if (!room) {
108100
return '';

apps/meteor/client/lib/rooms/roomTypes/favorite.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import { Meteor } from 'meteor/meteor';
2-
3-
import { settings } from '../../../../app/settings/client';
4-
import { getUserPreference } from '../../../../app/utils/client';
51
import { getFavoriteRoomType } from '../../../../lib/rooms/roomTypes/favorite';
62
import { roomCoordinator } from '../roomCoordinator';
73

@@ -13,9 +9,6 @@ roomCoordinator.add(
139
label: 'Favorites',
1410
},
1511
{
16-
condition(): boolean {
17-
return settings.get('Favorite_Rooms') && getUserPreference(Meteor.userId(), 'sidebarShowFavorites');
18-
},
1912
getIcon() {
2013
return 'star';
2114
},

apps/meteor/client/lib/rooms/roomTypes/livechat.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { AtLeast, ValueOf } from '@rocket.chat/core-typings';
22

3-
import { hasPermission } from '../../../../app/authorization/client';
4-
import { settings } from '../../../../app/settings/client';
53
import { getAvatarURL } from '../../../../app/utils/client/getAvatarURL';
64
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
75
import { RoomSettingsEnum, RoomMemberActions, UiTextContext } from '../../../../definition/IRoomTypeConfig';
@@ -45,10 +43,6 @@ roomCoordinator.add(
4543
}
4644
},
4745

48-
condition() {
49-
return settings.get('Livechat_enabled') && hasPermission('view-l-room');
50-
},
51-
5246
getAvatarPath(room) {
5347
return getAvatarURL({ username: `@${this.roomName(room)}` }) || '';
5448
},

apps/meteor/client/lib/rooms/roomTypes/private.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import type { AtLeast, IRoom } from '@rocket.chat/core-typings';
22
import { isRoomFederated } from '@rocket.chat/core-typings';
3-
import { Meteor } from 'meteor/meteor';
43

5-
import { hasPermission } from '../../../../app/authorization/client';
64
import { settings } from '../../../../app/settings/client';
7-
import { getUserPreference } from '../../../../app/utils/client';
85
import { getRoomAvatarURL } from '../../../../app/utils/client/getRoomAvatarURL';
96
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
107
import { RoomSettingsEnum, RoomMemberActions, UiTextContext } from '../../../../definition/IRoomTypeConfig';
@@ -80,11 +77,6 @@ roomCoordinator.add(
8077
}
8178
},
8279

83-
condition() {
84-
const groupByType = getUserPreference(Meteor.userId(), 'sidebarGroupByType');
85-
return groupByType && hasPermission('view-p-room');
86-
},
87-
8880
getAvatarPath(room) {
8981
return getRoomAvatarURL({ roomId: room._id, cache: room.avatarETag });
9082
},

apps/meteor/client/lib/rooms/roomTypes/public.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import type { AtLeast, IRoom } from '@rocket.chat/core-typings';
22
import { isRoomFederated } from '@rocket.chat/core-typings';
3-
import { Meteor } from 'meteor/meteor';
43

5-
import { hasAtLeastOnePermission } from '../../../../app/authorization/client';
64
import { settings } from '../../../../app/settings/client';
7-
import { getUserPreference } from '../../../../app/utils/client';
85
import { getRoomAvatarURL } from '../../../../app/utils/client/getRoomAvatarURL';
96
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
107
import { RoomSettingsEnum, RoomMemberActions, UiTextContext } from '../../../../definition/IRoomTypeConfig';
@@ -77,14 +74,6 @@ roomCoordinator.add(
7774
}
7875
},
7976

80-
condition() {
81-
const groupByType = getUserPreference(Meteor.userId(), 'sidebarGroupByType');
82-
return (
83-
groupByType &&
84-
(hasAtLeastOnePermission(['view-c-room', 'view-joined-room']) || settings.get('Accounts_AllowAnonymousRead') === true)
85-
);
86-
},
87-
8877
getAvatarPath(room) {
8978
return getRoomAvatarURL({ roomId: room._id, cache: room.avatarETag });
9079
},
@@ -113,10 +102,5 @@ roomCoordinator.add(
113102
};
114103
return Rooms.state.find(predicate);
115104
},
116-
117-
showJoinLink(roomId) {
118-
const predicate = (record: IRoom): boolean => record.t === 'c' && record._id === roomId;
119-
return !!Rooms.state.find(predicate);
120-
},
121105
} as AtLeast<IRoomTypeClientDirectives, 'isGroupChat' | 'roomName'>,
122106
);
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { Meteor } from 'meteor/meteor';
2-
3-
import { getUserPreference } from '../../../../app/utils/client';
41
import { getUnreadRoomType } from '../../../../lib/rooms/roomTypes/unread';
52
import { roomCoordinator } from '../roomCoordinator';
63

@@ -11,9 +8,5 @@ roomCoordinator.add(
118
...UnreadRoomType,
129
label: 'Unread',
1310
},
14-
{
15-
condition(): boolean {
16-
return getUserPreference(Meteor.userId(), 'sidebarShowUnread') as boolean;
17-
},
18-
},
11+
{},
1912
);

apps/meteor/client/lib/rooms/roomTypes/voip.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { AtLeast } from '@rocket.chat/core-typings';
22

3-
import { hasPermission } from '../../../../app/authorization/client';
4-
import { settings } from '../../../../app/settings/client';
53
import { getAvatarURL } from '../../../../app/utils/client/getAvatarURL';
64
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
75
import { getVoipRoomType } from '../../../../lib/rooms/roomTypes/voip';
@@ -20,10 +18,6 @@ roomCoordinator.add(
2018
return room.name || room.fname || (room as any).label;
2119
},
2220

23-
condition() {
24-
return settings.get('Livechat_enabled') && hasPermission('view-l-room');
25-
},
26-
2721
getAvatarPath(room) {
2822
return getAvatarURL({ username: `@${this.roomName(room)}` }) || '';
2923
},

apps/meteor/definition/IRoomTypeConfig.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ export interface IRoomTypeClientDirectives {
7676
roomName: (room: AtLeast<IRoom, '_id' | 'name' | 'fname' | 'prid'>) => string | undefined;
7777
isGroupChat: (room: Partial<IRoom>) => boolean;
7878
getUiText: (context: ValueOf<typeof UiTextContext>) => string;
79-
condition: () => boolean;
8079
getAvatarPath: (
8180
room: Pick<IRoom, '_id' | 'name' | 'fname' | 'prid' | 'avatarETag' | 'uids' | 'usernames'> & { username?: IRoom['_id'] },
8281
) => string;
8382
getIcon?: (room: Partial<IRoom>) => IconName;
8483
extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string };
8584
findRoom: (identifier: string) => IRoom | undefined;
86-
showJoinLink: (roomId: string) => boolean;
8785
isLivechatRoom: () => boolean;
8886
canSendMessage: (room: IRoom) => boolean;
8987
readOnly?: (room?: IRoom, user?: AtLeast<IUser, 'username'> | null) => boolean;

0 commit comments

Comments
 (0)