avatar now inside of profileBinary subnode, remove poll endpoint
This commit is contained in:
parent
6f835344ae
commit
32d7af3621
5 changed files with 5 additions and 26 deletions
|
|
@ -815,7 +815,7 @@ const setAvatar = (avatar, user) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
user
|
user
|
||||||
.get(Key.PROFILE)
|
.get(Key.PROFILE_BINARY)
|
||||||
.get(Key.AVATAR)
|
.get(Key.AVATAR)
|
||||||
.put(avatar, ack => {
|
.put(avatar, ack => {
|
||||||
if (ack.err && typeof ack.err !== 'number') {
|
if (ack.err && typeof ack.err !== 'number') {
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ const onAvatar = (cb, user) => {
|
||||||
if (!avatarSubbed) {
|
if (!avatarSubbed) {
|
||||||
avatarSubbed = true
|
avatarSubbed = true
|
||||||
user
|
user
|
||||||
.get(Key.PROFILE)
|
.get(Key.PROFILE_BINARY)
|
||||||
.get(Key.AVATAR)
|
.get(Key.AVATAR)
|
||||||
.on(avatar => {
|
.on(avatar => {
|
||||||
if (typeof avatar === 'string' || avatar === null) {
|
if (typeof avatar === 'string' || avatar === null) {
|
||||||
|
|
|
||||||
|
|
@ -60,3 +60,5 @@ exports.POSTS = 'posts'
|
||||||
exports.TOTAL_TIPS = 'totalTips'
|
exports.TOTAL_TIPS = 'totalTips'
|
||||||
|
|
||||||
exports.TIPS_PAYMENT_STATUS = 'tipsPaymentStatus'
|
exports.TIPS_PAYMENT_STATUS = 'tipsPaymentStatus'
|
||||||
|
|
||||||
|
exports.PROFILE_BINARY = 'profileBinary'
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ const onAvatar = (cb, pub) => {
|
||||||
require('../../Mediator')
|
require('../../Mediator')
|
||||||
.getGun()
|
.getGun()
|
||||||
.user(pub)
|
.user(pub)
|
||||||
.get(Key.PROFILE)
|
.get(Key.PROFILE_BINARY)
|
||||||
.get(Key.AVATAR)
|
.get(Key.AVATAR)
|
||||||
.on(av => {
|
.on(av => {
|
||||||
if (typeof av === 'string' || av === null) {
|
if (typeof av === 'string' || av === null) {
|
||||||
|
|
|
||||||
|
|
@ -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) => {
|
app.get(`/api/gun/${GunEvent.ON_DISPLAY_NAME}`, async (_, res) => {
|
||||||
try {
|
try {
|
||||||
const user = require('../services/gunDB/Mediator').getUser()
|
const user = require('../services/gunDB/Mediator').getUser()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue