Drop await usage for now-synchronous encodeFileToken() (#11612)
### Remove unnecessary `await` from `encodeFileToken` calls (now synchronous) #11611 #### Context In [PR #11385 – commit 26c17f3](https://github.com/twentyhq/twenty/pull/11385/commits/26c17f3205eb0cf4b93dd37cfec97638596ed263), `FileService.encodeFileToken()` was updated to be a **synchronous** method. However, several places in the codebase were still calling it using `await`. #### Changes This PR cleans up those redundant `await` usages to: - Improve clarity - Avoid confusion (no longer awaiting a non-Promise) - Slightly reduce overhead in affected functions - Removed `await` from calls to `this.fileService.encodeFileToken(...)`
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ export class ActivityQueryResultGetterHandler
|
|||||||
|
|
||||||
imageUrl.searchParams.delete('token');
|
imageUrl.searchParams.delete('token');
|
||||||
|
|
||||||
const signedPayload = await this.fileService.encodeFileToken({
|
const signedPayload = this.fileService.encodeFileToken({
|
||||||
noteBlockId: block.id,
|
noteBlockId: block.id,
|
||||||
workspaceId: workspaceId,
|
workspaceId: workspaceId,
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ export class AttachmentQueryResultGetterHandler
|
|||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
const signedPayload = await this.fileService.encodeFileToken({
|
const signedPayload = this.fileService.encodeFileToken({
|
||||||
attachmentId: attachment.id,
|
attachmentId: attachment.id,
|
||||||
workspaceId: workspaceId,
|
workspaceId: workspaceId,
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ export class PersonQueryResultGetterHandler
|
|||||||
return person;
|
return person;
|
||||||
}
|
}
|
||||||
|
|
||||||
const signedPayload = await this.fileService.encodeFileToken({
|
const signedPayload = this.fileService.encodeFileToken({
|
||||||
personId: person.id,
|
personId: person.id,
|
||||||
workspaceId: workspaceId,
|
workspaceId: workspaceId,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ export class UserResolver {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (workspaceMember && workspaceMember.avatarUrl) {
|
if (workspaceMember && workspaceMember.avatarUrl) {
|
||||||
const avatarUrlToken = await this.fileService.encodeFileToken({
|
const avatarUrlToken = this.fileService.encodeFileToken({
|
||||||
workspaceMemberId: workspaceMember.id,
|
workspaceMemberId: workspaceMember.id,
|
||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
});
|
});
|
||||||
@@ -233,7 +233,7 @@ export class UserResolver {
|
|||||||
|
|
||||||
for (const workspaceMemberEntity of workspaceMemberEntities) {
|
for (const workspaceMemberEntity of workspaceMemberEntities) {
|
||||||
if (workspaceMemberEntity.avatarUrl) {
|
if (workspaceMemberEntity.avatarUrl) {
|
||||||
const avatarUrlToken = await this.fileService.encodeFileToken({
|
const avatarUrlToken = this.fileService.encodeFileToken({
|
||||||
workspaceMemberId: workspaceMemberEntity.id,
|
workspaceMemberId: workspaceMemberEntity.id,
|
||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
});
|
});
|
||||||
@@ -318,7 +318,7 @@ export class UserResolver {
|
|||||||
workspaceId,
|
workspaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileToken = await this.fileService.encodeFileToken({
|
const fileToken = this.fileService.encodeFileToken({
|
||||||
workspaceId: workspaceId,
|
workspaceId: workspaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ export class WorkspaceInvitationResolver {
|
|||||||
let workspaceLogoWithToken = '';
|
let workspaceLogoWithToken = '';
|
||||||
|
|
||||||
if (workspace.logo) {
|
if (workspace.logo) {
|
||||||
const workspaceLogoToken = await this.fileService.encodeFileToken({
|
const workspaceLogoToken = this.fileService.encodeFileToken({
|
||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export class WorkspaceResolver {
|
|||||||
logo: paths[0],
|
logo: paths[0],
|
||||||
});
|
});
|
||||||
|
|
||||||
const workspaceLogoToken = await this.fileService.encodeFileToken({
|
const workspaceLogoToken = this.fileService.encodeFileToken({
|
||||||
workspaceId: id,
|
workspaceId: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ export class WorkspaceResolver {
|
|||||||
async logo(@Parent() workspace: Workspace): Promise<string> {
|
async logo(@Parent() workspace: Workspace): Promise<string> {
|
||||||
if (workspace.logo) {
|
if (workspace.logo) {
|
||||||
try {
|
try {
|
||||||
const workspaceLogoToken = await this.fileService.encodeFileToken({
|
const workspaceLogoToken = this.fileService.encodeFileToken({
|
||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ export class WorkspaceResolver {
|
|||||||
|
|
||||||
if (workspace.logo) {
|
if (workspace.logo) {
|
||||||
try {
|
try {
|
||||||
const workspaceLogoToken = await this.fileService.encodeFileToken({
|
const workspaceLogoToken = this.fileService.encodeFileToken({
|
||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user