Skip to content
Snippets Groups Projects
Commit 85bad8dd authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] `search [pattern]` command: add exclusions display

parent d4834c7f
No related branches found
No related tags found
No related merge requests found
...@@ -164,7 +164,7 @@ module.exports = { ...@@ -164,7 +164,7 @@ module.exports = {
const blocks = Underscore.sortBy(await findBlocksMatching(pattern, files), b => b.number) const blocks = Underscore.sortBy(await findBlocksMatching(pattern, files), b => b.number)
const events: { b: BlockDTO, event: (IdentityDTO|ShortCertificationDTO|MembershipDTO|ShortRevocation) }[] = [] const events: { b: BlockDTO, event: (IdentityDTO|ShortCertificationDTO|MembershipDTO|ShortRevocation|{ type: 'exclusion', pub: string }) }[] = []
for (const b of blocks) { for (const b of blocks) {
b.identities.filter(i => i.includes(pattern)).forEach(i => { b.identities.filter(i => i.includes(pattern)).forEach(i => {
events.push({ b, event: IdentityDTO.fromInline(i) }) events.push({ b, event: IdentityDTO.fromInline(i) })
...@@ -178,6 +178,9 @@ module.exports = { ...@@ -178,6 +178,9 @@ module.exports = {
b.revoked.filter(m => m.includes(pattern)).forEach(r => { b.revoked.filter(m => m.includes(pattern)).forEach(r => {
events.push({ b, event: RevocationDTO.fromInline(r) }) events.push({ b, event: RevocationDTO.fromInline(r) })
}) })
b.excluded.filter(m => m.includes(pattern)).forEach(r => {
events.push({ b, event: { type: 'exclusion', pub: r } })
})
} }
for (const e of events) { for (const e of events) {
...@@ -186,6 +189,10 @@ module.exports = { ...@@ -186,6 +189,10 @@ module.exports = {
const idty = e.event as IdentityDTO const idty = e.event as IdentityDTO
console.log('%s: new identity %s (created on %s)', date, idty.uid, await getDateFor(server, idty.buid as string)) console.log('%s: new identity %s (created on %s)', date, idty.uid, await getDateFor(server, idty.buid as string))
} }
if ((e.event as { type: 'exclusion', pub: string }).type === 'exclusion') {
const date = await getDateForBlock(e.b)
console.log('%s: excluded', date)
}
} }
console.log(events.map(e => e.event)) console.log(events.map(e => e.event))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment