set browniePoints timeout to 30 seconds for dev
This commit is contained in:
@ -6,6 +6,7 @@ import { saveUser, observeMethod } from '../../server/utils/rx';
|
|||||||
import { blacklistedUsernames } from '../../server/utils/constants';
|
import { blacklistedUsernames } from '../../server/utils/constants';
|
||||||
|
|
||||||
const debug = debugFactory('freecc:user:remote');
|
const debug = debugFactory('freecc:user:remote');
|
||||||
|
const BROWNIEPOINTS_TIMEOUT = [30, 'seconds'];
|
||||||
|
|
||||||
function getAboutProfile({
|
function getAboutProfile({
|
||||||
username,
|
username,
|
||||||
@ -213,7 +214,10 @@ module.exports = function(User) {
|
|||||||
cb(new TypeError('giver should be a string but got %s'));
|
cb(new TypeError('giver should be a string but got %s'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const oneHourAgo = moment().subtract(1, 'hour').valueOf();
|
let temp = moment();
|
||||||
|
const browniePoints = temp
|
||||||
|
.subtract.apply(temp, BROWNIEPOINTS_TIMEOUT)
|
||||||
|
.valueOf();
|
||||||
const user$ = findUser({ where: { username: receiver }});
|
const user$ = findUser({ where: { username: receiver }});
|
||||||
|
|
||||||
user$
|
user$
|
||||||
@ -229,7 +233,7 @@ module.exports = function(User) {
|
|||||||
.filter((timestamp) => !!timestamp || typeof timestamp === 'object')
|
.filter((timestamp) => !!timestamp || typeof timestamp === 'object')
|
||||||
// filterout timestamps older then an hour
|
// filterout timestamps older then an hour
|
||||||
.filter(({ timestamp = 0 }) => {
|
.filter(({ timestamp = 0 }) => {
|
||||||
return timestamp >= oneHourAgo;
|
return timestamp >= browniePoints;
|
||||||
})
|
})
|
||||||
// filter out brownie points given by giver
|
// filter out brownie points given by giver
|
||||||
.filter((browniePoint) => {
|
.filter((browniePoint) => {
|
||||||
|
Reference in New Issue
Block a user