Skip to content

Commit

Permalink
fix: send builder url as part of notification metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariano Goldman committed May 20, 2024
1 parent c3d358e commit 4f7daea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/controllers/handlers/permissions-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,13 @@ export async function postPermissionsHandler(

export async function putPermissionsAddressHandler(
ctx: HandlerContextWithPath<
'namePermissionChecker' | 'permissionsManager' | 'worldsManager' | 'notificationService',
'config' | 'namePermissionChecker' | 'permissionsManager' | 'worldsManager' | 'notificationService',
'/world/:world_name/permissions/:permission_name/:address'
> &
DecentralandSignatureContext<any>
): Promise<IHttpServerComponent.IResponse> {
const { namePermissionChecker, permissionsManager, worldsManager, notificationService } = ctx.components
const { config, namePermissionChecker, permissionsManager, worldsManager, notificationService } = ctx.components
const builderUrl = await config.requireString('BUILDER_URL')

const worldName = ctx.params.world_name
const permissionName = ctx.params.permission_name as Permission
Expand Down Expand Up @@ -188,7 +189,8 @@ export async function putPermissionsAddressHandler(
title: 'Worlds permission granted',
description: `You have been granted ${permissionName} permission for world ${worldName}`,
world: worldName,
permissions: [permissionName]
permissions: [permissionName],
url: `${builderUrl}/worlds?tab=dcl`
},
timestamp: Date.now()
}
Expand All @@ -201,12 +203,13 @@ export async function putPermissionsAddressHandler(

export async function deletePermissionsAddressHandler(
ctx: HandlerContextWithPath<
'namePermissionChecker' | 'permissionsManager' | 'worldsManager' | 'notificationService',
'config' | 'namePermissionChecker' | 'permissionsManager' | 'worldsManager' | 'notificationService',
'/world/:world_name/permissions/:permission_name/:address'
> &
DecentralandSignatureContext<any>
): Promise<IHttpServerComponent.IResponse> {
const { namePermissionChecker, permissionsManager, worldsManager, notificationService } = ctx.components
const { config, namePermissionChecker, permissionsManager, worldsManager, notificationService } = ctx.components
const builderUrl = await config.requireString('BUILDER_URL')

const worldName = ctx.params.world_name
const permissionName = ctx.params.permission_name as Permission
Expand Down Expand Up @@ -248,7 +251,8 @@ export async function deletePermissionsAddressHandler(
title: 'World permission revoked',
description: `Your ${permissionName} permission for world ${worldName} has been revoked`,
world: worldName,
permissions: [permissionName]
permissions: [permissionName],
url: `${builderUrl}/worlds?tab=dcl`
},
timestamp: Date.now()
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/permissions-handlers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ test('PermissionsHandler', function ({ components, stubComponents }) {
})
})

describe(`PUT and DELETE /world/${worldName}/permissions/[:permission]/[:address]`, function () {
describe(`PUT and DELETE /world/:worldName/permissions/[:permission]/[:address]`, function () {
let alreadyAllowedWallet: Identity

beforeEach(async () => {
Expand Down

0 comments on commit 4f7daea

Please sign in to comment.