send reply notice when importing matrix post
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 34s Details

This commit is contained in:
Ladd Hoffman 2024-04-27 16:11:10 -05:00
parent 0b6d147f9c
commit d2d781aef3
1 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,10 @@ const { matrixUserToAuthorAddress } = require('../util/db');
const write = require('./write');
const { dao } = require('../util/contracts');
const {
ETH_NETWORK,
} = process.env;
const addPostWithRetry = async (authors, hash, citations, retryDelay = 5000) => {
try {
await dao.addPost(authors, hash, citations);
@ -76,6 +80,8 @@ module.exports = async (req, res) => {
console.log(`Post already added for matrix event ${eventUri}`);
} else {
console.log(`Added post to blockchain for matrix event ${eventUri}`);
// Send matrix event reply to the targeted event, notifying of this blockchain post
await client.replyNotice(roomId, event, `Added to ${ETH_NETWORK} blockchain as post ${hash}`);
}
res.json({ postId: hash, alreadyAdded });