Skip to content

Commit

Permalink
Merge pull request #94 from logion-network/feature/remove-loc-created
Browse files Browse the repository at this point in the history
chore: remove template loc-created.
  • Loading branch information
benoitdevos authored Mar 7, 2022
2 parents bfc4b0e + 3527724 commit b8b574f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 40 deletions.
15 changes: 0 additions & 15 deletions resources/mail/loc-created.pug

This file was deleted.

11 changes: 3 additions & 8 deletions src/logion/controllers/locrequest.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,9 @@ export class LocRequestController extends ApiController {
await this.checkIdentityLoc(request.requesterIdentityLocId)
await this.locRequestRepository.save(request);
const userIdentity = await this.findUserIdentity(request);
if (userIdentity) {
if (authenticatedUser.isNodeOwner()) {
this.getNotificationInfo(request.getDescription(), userIdentity)
.then(info => this.notificationService.notify(info.walletUserEmail, "loc-created", info.data))
} else {
this.getNotificationInfo(request.getDescription(), userIdentity)
.then(info => this.notificationService.notify(info.legalOfficerEMail, "loc-requested", info.data))
}
if (!authenticatedUser.isNodeOwner() && userIdentity) {
this.getNotificationInfo(request.getDescription(), userIdentity)
.then(info => this.notificationService.notify(info.legalOfficerEMail, "loc-requested", info.data))
}
return this.toView(request, userIdentity);
}
Expand Down
1 change: 0 additions & 1 deletion src/logion/services/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const templateValues = [
"loc-requested",
"loc-accepted",
"loc-rejected",
"loc-created",
"all-documented-vars"
] as const;

Expand Down
17 changes: 1 addition & 16 deletions test/unit/controllers/locrequest.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ describe('LocRequestController', () => {
expect(userIdentity.email).toBe("[email protected]");
expect(userIdentity.phoneNumber).toBe("+1234");
});

notificationService.verify(instance => instance.notify("[email protected]", "loc-requested", It.Is<any>(data => {
return data.loc.locType === locType
})))
}

it('succeeds to create a Transaction loc request with embedded user identity', async () => {
Expand Down Expand Up @@ -162,10 +158,6 @@ describe('LocRequestController', () => {
expect(userIdentity.email).toBe("[email protected]");
expect(userIdentity.phoneNumber).toBe("+6789");
});

notificationService.verify(instance => instance.notify(testUserIdentity.email, "loc-created", It.Is<any>(data => {
return data.loc.locType === locType
})))
}

it('succeeds to create open Transaction loc with existing protection request', async () => {
Expand Down Expand Up @@ -198,10 +190,6 @@ describe('LocRequestController', () => {
expect(userIdentity.email).toBe("[email protected]");
expect(userIdentity.phoneNumber).toBe("+1234");
});

notificationService.verify(instance => instance.notify("[email protected]", "loc-created", It.Is<any>(data => {
return data.loc.locType === locType
})))
}

it('succeeds to create open Transaction loc with embedded user identity', async () => {
Expand Down Expand Up @@ -236,10 +224,6 @@ describe('LocRequestController', () => {
expect(userIdentity.email).toBe("[email protected]");
expect(userIdentity.phoneNumber).toBe("+0101");
});

notificationService.verify(instance => instance.notify("[email protected]", "loc-created", It.Is<any>(data => {
return data.loc.locType === "Transaction"
})))
});

async function testLocRequestCreation(locType: LocType) {
Expand Down Expand Up @@ -268,6 +252,7 @@ describe('LocRequestController', () => {
notificationService.verify(instance => instance.notify("[email protected]", "loc-requested", It.Is<any>(data => {
return data.loc.locType === locType
})))

}

it('succeeds to create Transaction loc request with existing protection request', async () => {
Expand Down

0 comments on commit b8b574f

Please sign in to comment.