Skip to content

Commit

Permalink
fix: correctly announce accepted/rejected
Browse files Browse the repository at this point in the history
  • Loading branch information
greenlucid committed Jan 27, 2023
1 parent b580a01 commit 5829722
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/get-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface EventDetails {
requestType?: "RegistrationRequested" | "ClearingRequested"
party?: string
side?: number
itemStatus?: "Absent" | "Registered" | string
}

export interface CurateEvent {
Expand Down Expand Up @@ -62,7 +63,7 @@ const parseRequestResolved = (
registrationMetaEvidenceURI:
request.registry.registrationMetaEvidence.URI,
finalRuling: request.finalRuling,
requestType: request.requestType,
itemStatus: request.item.status,
},
}
}
Expand Down Expand Up @@ -297,6 +298,7 @@ const getEvents = async (
resolutionTime
item {
itemID
status
}
registry {
id
Expand Down
12 changes: 7 additions & 5 deletions src/handlers/request-resolved.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ const handleRequestResolved = async (
const twitterId = await dbAttempt(key, db)

// todo itemName could make message too large
const message = `${
event.details.requestType === "RegistrationRequested"
? `${capitalizeFirstLetter(meta.itemName)} accepted into the`
: `${capitalizeFirstLetter(meta.itemName)} removed from the`
} ${meta.tcrTitle} List in ${config.NETWORK_NAME}.
const message = `
${capitalizeFirstLetter(meta.itemName)}
${event.details.itemStatus === "Registered"
? " accepted into the"
: event.details.itemStatus === "Absent" ? " removed from the" : " has finalized its request in"
}
${" "+meta.tcrTitle} List in ${config.NETWORK_NAME}.
\n\nListing: ${link}`

console.info("-------vvvvvvv-------")
Expand Down

0 comments on commit 5829722

Please sign in to comment.