-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and use same schema as reportinator server
- Loading branch information
Showing
6 changed files
with
101 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export default class ReportRequest { | ||
constructor(reportedEvent, reporterPubkey, reporterText) { | ||
this.reportedEvent = reportedEvent; | ||
this.reporterPubkey = reporterPubkey; | ||
this.reporterText = reporterText; | ||
} | ||
|
||
static fromCloudEvent(cloudEvent) { | ||
const data = cloudEvent.data.message.data; | ||
const jsonString = data ? Buffer.from(data, "base64").toString() : "{}"; | ||
const json = JSON.parse(jsonString); | ||
|
||
if (json?.reportedEvent) { | ||
return new ReportRequest( | ||
json.reportedEvent, | ||
json?.reporterPubkey, | ||
json?.reporterText | ||
); | ||
} | ||
|
||
return new ReportRequest(json, null, null); | ||
} | ||
|
||
canBeManualVerified() { | ||
return Boolean(this.reporterPubkey); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
export default class Slack { | ||
static async postManualVerification(nostrEventJson, userReportRequest) { | ||
console.log(`userReportRequest: ${userReportRequest}`); | ||
static async postManualVerification(reportRequest) { | ||
console.log( | ||
`TODO: Implement Slack.postManualVerification.\n | ||
Event payload: ${JSON.stringify(reportRequest.reportedEvent)}\n | ||
Reporter pubkey: ${reportRequest.reporterPubkey}\n | ||
Reporter text: ${reportRequest.reporterText}` | ||
); | ||
} | ||
} |
Oops, something went wrong.