diff --git a/services/gunDB/Mediator/index.js b/services/gunDB/Mediator/index.js index 8540002f..d317b15a 100644 --- a/services/gunDB/Mediator/index.js +++ b/services/gunDB/Mediator/index.js @@ -239,6 +239,10 @@ const getGun = () => { } const getUser = () => { + if (!user.is) { + logger.warn('called getUser() without being authed') + throw new Error('NOT_AUTH') + } return user } diff --git a/services/gunDB/contact-api/events/index.js b/services/gunDB/contact-api/events/index.js index bae689e0..0f672754 100644 --- a/services/gunDB/contact-api/events/index.js +++ b/services/gunDB/contact-api/events/index.js @@ -527,11 +527,11 @@ const onChats = cb => { if (!onChatsSubbed) { const Streams = require('../streams') - onChatsSubbed = true onOutgoing(processChats) Streams.onAvatar(processChats) Streams.onDisplayName(processChats) Streams.onPubToFeed(processChats) + onChatsSubbed = true } return () => { diff --git a/services/gunDB/contact-api/utils/index.js b/services/gunDB/contact-api/utils/index.js index 03758c87..63432cd7 100644 --- a/services/gunDB/contact-api/utils/index.js +++ b/services/gunDB/contact-api/utils/index.js @@ -105,6 +105,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => { } } catch (e) { logger.error(e) + if (e.message === 'NOT_AUTH') { + throw e + } } logger.info( @@ -132,6 +135,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => { } } catch (e) { logger.error(e) + if (e.message === 'NOT_AUTH') { + throw e + } } logger.info(