Skip to content

Commit

Permalink
Remove unused exports
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Nov 2, 2024
1 parent 8dae49a commit 65167f1
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 44 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/app/assets/server/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class RocketChatAssetsClass {

export const RocketChatAssets = new RocketChatAssetsClass();

export async function addAssetToSetting(asset: string, value: IRocketChatAsset, options?: Partial<ISetting>): Promise<void> {
async function addAssetToSetting(asset: string, value: IRocketChatAsset, options?: Partial<ISetting>): Promise<void> {
const key = `Assets_${asset}`;

await settingsRegistry.add(
Expand Down
21 changes: 0 additions & 21 deletions apps/meteor/app/authorization/client/hasPermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,4 @@ export const hasAllPermission = (
export const hasAtLeastOnePermission = (permissions: IPermission['_id'] | IPermission['_id'][], scope?: string): boolean =>
validatePermissions(permissions, scope, atLeastOne);

export const userHasAllPermission = (
permissions: IPermission['_id'] | IPermission['_id'][],
scope?: string,
userId?: IUser['_id'] | null,
): boolean => validatePermissions(permissions, scope, all, userId);

export const hasPermission = hasAllPermission;

/**
* This function is used to check if the user will have the permission after something happens.
* For example, The user is creating a new channel and he wants to set read-only config to true.
* This is a problem, set-readonly is a permission related with the scoped permissions `owner`
* so the user cannot set this permission to true during the channel creation, because there is no room yet to be owned and used as scope, but is possible
* during the channel update, which is weird.
*
* @param permissions The permissions to check
* @param scopedRoles The scoped roles to check to be included in the user roles
* @returns If the user will have the permission
*/

export const willHavePermission = (permissions: IPermission['_id'] | IPermission['_id'][], scopedRoles: IPermission['_id'][]): boolean =>
validatePermissions(permissions, undefined, all, undefined, scopedRoles);
6 changes: 3 additions & 3 deletions apps/meteor/app/authorization/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hasAllPermission, hasAtLeastOnePermission, hasPermission, userHasAllPermission } from './hasPermission';
import { hasRole, hasAnyRole } from './hasRole';
import { hasAllPermission, hasAtLeastOnePermission, hasPermission } from './hasPermission';
import { hasRole } from './hasRole';
import './restrictedRoles';

export { hasAllPermission, hasAtLeastOnePermission, hasRole, hasAnyRole, hasPermission, userHasAllPermission };
export { hasAllPermission, hasAtLeastOnePermission, hasRole, hasPermission };
4 changes: 1 addition & 3 deletions apps/meteor/app/authorization/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { roomAccessAttributes, canAccessRoomAsync } from './functions/canAccessRoom';
import { getRoles } from './functions/getRoles';
import { getUsersInRole } from './functions/getUsersInRole';
import { subscriptionHasRole } from './functions/hasRole';
import './methods/addPermissionToRole';
import './methods/addUserToRole';
Expand All @@ -9,4 +7,4 @@ import './methods/removeRoleFromPermission';
import './methods/removeUserFromRole';
import './streamer/permissions';

export { getRoles, getUsersInRole, subscriptionHasRole, canAccessRoomAsync, roomAccessAttributes };
export { subscriptionHasRole, canAccessRoomAsync, roomAccessAttributes };
11 changes: 0 additions & 11 deletions apps/meteor/app/cloud/server/functions/getWorkspaceAccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,6 @@ export async function getWorkspaceAccessTokenOrThrow(forceNew = false, scope = '
return token;
}

export const generateWorkspaceBearerHttpHeaderOrThrow = async (
forceNew = false,
scope = '',
save = true,
): Promise<{ Authorization: string }> => {
const token = await getWorkspaceAccessTokenOrThrow(forceNew, scope, save);
return {
Authorization: `Bearer ${token}`,
};
};

export const generateWorkspaceBearerHttpHeader = async (
forceNew = false,
scope = '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const wrapPromise = <T>(
error,
}));

export const handleResponse = async <T>(promise: Promise<Response>) => {
const handleResponse = async <T>(promise: Promise<Response>) => {
return wrapPromise<T>(
(async () => {
const request = await promise;
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/e2e/server/functions/resetRoomKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function resetRoomKey(roomId: string, userId: string, newRoomKey: s
}
}

export function pushToLimit(
function pushToLimit(
arr: NonNullable<IRoom['usersWaitingForE2EKeys']>,
item: NonNullable<IRoom['usersWaitingForE2EKeys']>[number],
limit = 50,
Expand All @@ -107,7 +107,7 @@ async function writeAndNotify(updateOps: AnyBulkWriteOperation<ISubscription>[],
updateOps.length = 0;
}

export function replicateMongoSlice(keyId: string, sub: ISubscription) {
function replicateMongoSlice(keyId: string, sub: ISubscription) {
if (!sub.E2EKey) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/e2e/server/methods/updateGroupKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare module '@rocket.chat/ddp-client' {
}
}

export async function updateGroupKey(rid: string, uid: string, key: string, callerUserId: string) {
async function updateGroupKey(rid: string, uid: string, key: string, callerUserId: string) {
// I have a subscription to this room
const mySub = await Subscriptions.findOneByRoomIdAndUserId(rid, callerUserId);

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/emoji/client/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const getEmojisBySearchTerm = (
return emojis;
};

export const removeFromRecent = (emoji: string, recentEmojis: string[], setRecentEmojis: (emojis: string[]) => void) => {
const removeFromRecent = (emoji: string, recentEmojis: string[], setRecentEmojis: (emojis: string[]) => void) => {
const _emoji = emoji.replace(/(^:|:$)/g, '');
const pos = recentEmojis.indexOf(_emoji as never);

Expand Down

0 comments on commit 65167f1

Please sign in to comment.