Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions apps/meteor/client/lib/rooms/roomCoordinator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,12 @@ class RoomCoordinatorClient extends RoomCoordinator {
getUiText(_context: ValueOf<typeof UiTextContext>): string {
return '';
},
condition(): boolean {
return true;
},
getAvatarPath(_room): string {
return '';
},
findRoom(_identifier: string): IRoom | undefined {
return undefined;
},
showJoinLink(_roomId: string): boolean {
return false;
},
isLivechatRoom(): boolean {
return false;
},
Expand Down
10 changes: 1 addition & 9 deletions apps/meteor/client/lib/rooms/roomTypes/conversation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Meteor } from 'meteor/meteor';

import { getUserPreference } from '../../../../app/utils/client';
import { getConversationRoomType } from '../../../../lib/rooms/roomTypes/conversation';
import { roomCoordinator } from '../roomCoordinator';

Expand All @@ -11,10 +8,5 @@ roomCoordinator.add(
...ConversationRoomType,
label: 'Conversations',
},
{
condition(): boolean {
// returns true only if sidebarGroupByType is not set
return !getUserPreference(Meteor.userId(), 'sidebarGroupByType');
},
},
{},
);
8 changes: 0 additions & 8 deletions apps/meteor/client/lib/rooms/roomTypes/direct.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import type { AtLeast, IRoom } from '@rocket.chat/core-typings';
import { isRoomFederated } from '@rocket.chat/core-typings';
import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';
import { Meteor } from 'meteor/meteor';

import { hasAtLeastOnePermission } from '../../../../app/authorization/client';
import { settings } from '../../../../app/settings/client';
import { getUserPreference } from '../../../../app/utils/client';
import { getAvatarURL } from '../../../../app/utils/client/getAvatarURL';
import { getUserAvatarURL } from '../../../../app/utils/client/getUserAvatarURL';
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
Expand Down Expand Up @@ -98,11 +95,6 @@ roomCoordinator.add(
}
},

condition() {
const groupByType = getUserPreference(Meteor.userId(), 'sidebarGroupByType');
return groupByType && hasAtLeastOnePermission(['view-d-room', 'view-joined-room']);
},

getAvatarPath(room) {
if (!room) {
return '';
Expand Down
7 changes: 0 additions & 7 deletions apps/meteor/client/lib/rooms/roomTypes/favorite.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { Meteor } from 'meteor/meteor';

import { settings } from '../../../../app/settings/client';
import { getUserPreference } from '../../../../app/utils/client';
import { getFavoriteRoomType } from '../../../../lib/rooms/roomTypes/favorite';
import { roomCoordinator } from '../roomCoordinator';

Expand All @@ -13,9 +9,6 @@ roomCoordinator.add(
label: 'Favorites',
},
{
condition(): boolean {
return settings.get('Favorite_Rooms') && getUserPreference(Meteor.userId(), 'sidebarShowFavorites');
},
getIcon() {
return 'star';
},
Expand Down
6 changes: 0 additions & 6 deletions apps/meteor/client/lib/rooms/roomTypes/livechat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { AtLeast, ValueOf } from '@rocket.chat/core-typings';

import { hasPermission } from '../../../../app/authorization/client';
import { settings } from '../../../../app/settings/client';
import { getAvatarURL } from '../../../../app/utils/client/getAvatarURL';
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
import { RoomSettingsEnum, RoomMemberActions, UiTextContext } from '../../../../definition/IRoomTypeConfig';
Expand Down Expand Up @@ -45,10 +43,6 @@ roomCoordinator.add(
}
},

condition() {
return settings.get('Livechat_enabled') && hasPermission('view-l-room');
},

getAvatarPath(room) {
return getAvatarURL({ username: `@${this.roomName(room)}` }) || '';
},
Expand Down
8 changes: 0 additions & 8 deletions apps/meteor/client/lib/rooms/roomTypes/private.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { AtLeast, IRoom } from '@rocket.chat/core-typings';
import { isRoomFederated } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';

import { hasPermission } from '../../../../app/authorization/client';
import { settings } from '../../../../app/settings/client';
import { getUserPreference } from '../../../../app/utils/client';
import { getRoomAvatarURL } from '../../../../app/utils/client/getRoomAvatarURL';
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
import { RoomSettingsEnum, RoomMemberActions, UiTextContext } from '../../../../definition/IRoomTypeConfig';
Expand Down Expand Up @@ -80,11 +77,6 @@ roomCoordinator.add(
}
},

condition() {
const groupByType = getUserPreference(Meteor.userId(), 'sidebarGroupByType');
return groupByType && hasPermission('view-p-room');
},

getAvatarPath(room) {
return getRoomAvatarURL({ roomId: room._id, cache: room.avatarETag });
},
Expand Down
16 changes: 0 additions & 16 deletions apps/meteor/client/lib/rooms/roomTypes/public.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { AtLeast, IRoom } from '@rocket.chat/core-typings';
import { isRoomFederated } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';

import { hasAtLeastOnePermission } from '../../../../app/authorization/client';
import { settings } from '../../../../app/settings/client';
import { getUserPreference } from '../../../../app/utils/client';
import { getRoomAvatarURL } from '../../../../app/utils/client/getRoomAvatarURL';
import type { IRoomTypeClientDirectives } from '../../../../definition/IRoomTypeConfig';
import { RoomSettingsEnum, RoomMemberActions, UiTextContext } from '../../../../definition/IRoomTypeConfig';
Expand Down Expand Up @@ -77,14 +74,6 @@ roomCoordinator.add(
}
},

condition() {
const groupByType = getUserPreference(Meteor.userId(), 'sidebarGroupByType');
return (
groupByType &&
(hasAtLeastOnePermission(['view-c-room', 'view-joined-room']) || settings.get('Accounts_AllowAnonymousRead') === true)
);
},

getAvatarPath(room) {
return getRoomAvatarURL({ roomId: room._id, cache: room.avatarETag });
},
Expand Down Expand Up @@ -113,10 +102,5 @@ roomCoordinator.add(
};
return Rooms.state.find(predicate);
},

showJoinLink(roomId) {
const predicate = (record: IRoom): boolean => record.t === 'c' && record._id === roomId;
return !!Rooms.state.find(predicate);
},
} as AtLeast<IRoomTypeClientDirectives, 'isGroupChat' | 'roomName'>,
);
9 changes: 1 addition & 8 deletions apps/meteor/client/lib/rooms/roomTypes/unread.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Meteor } from 'meteor/meteor';

import { getUserPreference } from '../../../../app/utils/client';
import { getUnreadRoomType } from '../../../../lib/rooms/roomTypes/unread';
import { roomCoordinator } from '../roomCoordinator';

Expand All @@ -11,9 +8,5 @@ roomCoordinator.add(
...UnreadRoomType,
label: 'Unread',
},
{
condition(): boolean {
return getUserPreference(Meteor.userId(), 'sidebarShowUnread') as boolean;
},
},
{},
);
6 changes: 0 additions & 6 deletions apps/meteor/client/lib/rooms/roomTypes/voip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { AtLeast } from '@rocket.chat/core-typings';

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

condition() {
return settings.get('Livechat_enabled') && hasPermission('view-l-room');
},

getAvatarPath(room) {
return getAvatarURL({ username: `@${this.roomName(room)}` }) || '';
},
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/definition/IRoomTypeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ export interface IRoomTypeClientDirectives {
roomName: (room: AtLeast<IRoom, '_id' | 'name' | 'fname' | 'prid'>) => string | undefined;
isGroupChat: (room: Partial<IRoom>) => boolean;
getUiText: (context: ValueOf<typeof UiTextContext>) => string;
condition: () => boolean;
getAvatarPath: (
room: Pick<IRoom, '_id' | 'name' | 'fname' | 'prid' | 'avatarETag' | 'uids' | 'usernames'> & { username?: IRoom['_id'] },
) => string;
getIcon?: (room: Partial<IRoom>) => IconName;
extractOpenRoomParams?: (routeParams: Record<string, string | null | undefined>) => { type: RoomType; reference: string };
findRoom: (identifier: string) => IRoom | undefined;
showJoinLink: (roomId: string) => boolean;
isLivechatRoom: () => boolean;
canSendMessage: (room: IRoom) => boolean;
readOnly?: (room?: IRoom, user?: AtLeast<IUser, 'username'> | null) => boolean;
Expand Down
Loading