avatar now inside of profileBinary subnode, remove poll endpoint

This commit is contained in:
Daniel Lugo 2020-10-14 14:39:13 -04:00
parent 6f835344ae
commit 32d7af3621
5 changed files with 5 additions and 26 deletions

View file

@ -815,7 +815,7 @@ const setAvatar = (avatar, user) =>
}
user
.get(Key.PROFILE)
.get(Key.PROFILE_BINARY)
.get(Key.AVATAR)
.put(avatar, ack => {
if (ack.err && typeof ack.err !== 'number') {

View file

@ -114,7 +114,7 @@ const onAvatar = (cb, user) => {
if (!avatarSubbed) {
avatarSubbed = true
user
.get(Key.PROFILE)
.get(Key.PROFILE_BINARY)
.get(Key.AVATAR)
.on(avatar => {
if (typeof avatar === 'string' || avatar === null) {

View file

@ -60,3 +60,5 @@ exports.POSTS = 'posts'
exports.TOTAL_TIPS = 'totalTips'
exports.TIPS_PAYMENT_STATUS = 'tipsPaymentStatus'
exports.PROFILE_BINARY = 'profileBinary'

View file

@ -34,7 +34,7 @@ const onAvatar = (cb, pub) => {
require('../../Mediator')
.getGun()
.user(pub)
.get(Key.PROFILE)
.get(Key.PROFILE_BINARY)
.get(Key.AVATAR)
.on(av => {
if (typeof av === 'string' || av === null) {

View file

@ -2107,29 +2107,6 @@ module.exports = async (
}
})
app.get(`/api/gun/${GunEvent.ON_AVATAR}`, async (_, res) => {
try {
const user = require('../services/gunDB/Mediator').getUser()
const data = await timeout5(
user
.get(Key.PROFILE)
.get(Key.AVATAR)
.then()
)
res.json({
data
})
} catch (err) {
logger.info('Error in Avatar poll:')
logger.error(err)
res
.status(err.message === Common.Constants.ErrorCode.NOT_AUTH ? 401 : 500)
.json({
errorMessage: typeof err === 'string' ? err : err.message
})
}
})
app.get(`/api/gun/${GunEvent.ON_DISPLAY_NAME}`, async (_, res) => {
try {
const user = require('../services/gunDB/Mediator').getUser()