mirror of
https://github.com/status-im/autobounty.git
synced 2025-02-27 20:40:45 +00:00
Fixed contract address length and action condition
This commit is contained in:
parent
069f031e3e
commit
f59d7ce840
@ -22,7 +22,7 @@ const logger = winston.createLogger({
|
|||||||
|
|
||||||
|
|
||||||
const needsFunding = function (req) {
|
const needsFunding = function (req) {
|
||||||
if (req.body.action === 'edited' || !req.body.hasOwnProperty('comment')) {
|
if (req.body.action !== 'edited' || !req.body.hasOwnProperty('comment')) {
|
||||||
return false
|
return false
|
||||||
} else if (req.body.comment.user.login !== config.githubUsername) {
|
} else if (req.body.comment.user.login !== config.githubUsername) {
|
||||||
return false
|
return false
|
||||||
@ -43,7 +43,7 @@ const hasAddress = function (req) {
|
|||||||
|
|
||||||
const getAddress = function (req) {
|
const getAddress = function (req) {
|
||||||
const commentBody = req.body.comment.body;
|
const commentBody = req.body.comment.body;
|
||||||
return commentBody.substring(commentBody.search("Contract address:") + 18, commentBody.search("Contract address:") + 60)
|
return commentBody.substring(commentBody.search("Contract address:") + 19, commentBody.search("Contract address:") + 61)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLabelMock = function (req) {
|
const getLabelMock = function (req) {
|
||||||
|
2
index.js
2
index.js
@ -3,7 +3,6 @@
|
|||||||
* and in case it's a comment that has "@autobounty <decimal> <currency>"
|
* and in case it's a comment that has "@autobounty <decimal> <currency>"
|
||||||
* awards that bounty to the address posted earlier in the thread (by the
|
* awards that bounty to the address posted earlier in the thread (by the
|
||||||
* commiteth bot).
|
* commiteth bot).
|
||||||
* TODO tests
|
|
||||||
* REVIEW parsing, non-persisting storage of addresses, hardcoded string length.
|
* REVIEW parsing, non-persisting storage of addresses, hardcoded string length.
|
||||||
* Depends on commiteth version as of 2017-06-10.
|
* Depends on commiteth version as of 2017-06-10.
|
||||||
*/
|
*/
|
||||||
@ -31,7 +30,6 @@ app.post(`${config.urlEndpoint}`, jsonParser, function (req, res, next) {
|
|||||||
} else if (!bot.needsFunding(req)) {
|
} else if (!bot.needsFunding(req)) {
|
||||||
return res.sendStatus(204);
|
return res.sendStatus(204);
|
||||||
}
|
}
|
||||||
|
|
||||||
validation = validateRequest(req);
|
validation = validateRequest(req);
|
||||||
|
|
||||||
if (validation.correct) {
|
if (validation.correct) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user