Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Merge 44b1249 into 5bc5c25
Browse files Browse the repository at this point in the history
  • Loading branch information
tboeckmann committed Dec 2, 2019
2 parents 5bc5c25 + 44b1249 commit 3554709
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mailchain-web",
"version": "0.0.5",
"version": "0.0.6",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
14 changes: 8 additions & 6 deletions src/app/inbox/inbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,14 @@ export class InboxComponent implements OnInit {
protocols = res["protocols"]
if (protocols.length > 0) {
protocols.forEach(protocol => {
protocol["networks"].forEach(network => {
this.networks.push({
label: network,
value: network,
})
});
if (protocol["name"] == "ethereum" ) {
protocol["networks"].forEach(network => {
this.networks.push({
label: network["name"],
value: network["name"],
})
});
}
});
}
});
Expand Down
5 changes: 5 additions & 0 deletions src/app/services/mailchain/mailchain.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ describe('MailchainService', () => {
expect(mailchainService.filterMessages(messages, {status: "error", readState: true, headersTo: address2})).toEqual([ messages[1] ])
expect(mailchainService.filterMessages(messages, {status: "error", readState: false, headersTo: address2})).toEqual([ messages[3] ])
})
it('should handle messages returned as null', () => {
expect(mailchainService.filterMessages(null, { status: "ok" })).toEqual([])
expect(mailchainService.filterMessages(null, { readState: true })).toEqual([])
expect(mailchainService.filterMessages(null, { headersTo: address1 })).toEqual([])
})
})

describe('validateEnsName', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/app/services/mailchain/mailchain.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ export class MailchainService {
let readState = options.readState
let headersTo = options.headersTo
let output = msgsArray
if (status != undefined ) {
output = output.filter(msg => msg.status === status)
if (status != undefined) {
output = output == null ? [] : output.filter(msg => msg.status === status)
}
if (readState != undefined) {
output = output.filter(msg => msg.read === readState)
output = output == null ? [] : output.filter(msg => msg.read === readState)
}
if (headersTo != undefined) {
output = output.filter(msg =>
output = output == null ? [] : output.filter(msg =>
this.parseAddressFromMailchain(msg["headers"]["to"]) == headersTo
)
}
Expand Down
9 changes: 4 additions & 5 deletions src/app/test/test-helpers/mailchain-test.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,8 @@ export class MailchainTestService {

public protocolsServerResponse(): any {
return {
"protocols": [{
"name": "ethereum",
"networks": ["goerli", "kovan", "mainnet", "rinkeby", "ropsten"]
}]
"protocols":
[{ "name": "ethereum", "networks": [{ "name": "goerli", "id": "" }, { "name": "kovan", "id": "" }, { "name": "mainnet", "id": "" }, { "name": "rinkeby", "id": "" }, { "name": "ropsten", "id": "" }] }, { "name": "substrate", "networks": [{ "name": "edgeware-testnet", "id": "42" }] }]
}
}

Expand All @@ -263,7 +261,8 @@ export class MailchainTestService {
{ label: "kovan", value: "kovan"},
{ label: "mainnet", value: "mainnet"},
{ label: "rinkeby", value: "rinkeby"},
{ label: "ropsten", value: "ropsten"}
{ label: "ropsten", value: "ropsten"},
// { label: "edgeware-testnet", value: "edgeware-testnet"}
]
}

Expand Down

0 comments on commit 3554709

Please sign in to comment.