From 0e01a1fe1af7390df0eeceb7feedfbee3340987f Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Thu, 27 Aug 2020 11:42:40 +0200 Subject: [PATCH 1/2] socket on to generate wall --- services/gunDB/Mediator/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/services/gunDB/Mediator/index.js b/services/gunDB/Mediator/index.js index bb590285..e48a4f4e 100644 --- a/services/gunDB/Mediator/index.js +++ b/services/gunDB/Mediator/index.js @@ -510,6 +510,7 @@ class Mediator { this.generateHandshakeNode ) this.socket.on('GENERATE_ORDER_ADDRESS', this.generateOrderAddress) + this.socket.on('INIT_FEED_WALL', this.initWall) this.socket.on(Action.SEND_HANDSHAKE_REQUEST, this.sendHandshakeRequest) this.socket.on( Action.SEND_HANDSHAKE_REQUEST_WITH_INITIAL_MSG, @@ -772,6 +773,32 @@ class Mediator { } } + /** + * @param {Readonly<{ token: string }>} body + */ + initWall = async body => { + try { + const { token } = body + + await throwOnInvalidToken(token) + + await API.Actions.initWall() + + this.socket.emit('INIT_FEED_WALL', { + ok: true, + msg: null, + origBody: body + }) + } catch (err) { + logger.info(err) + this.socket.emit('INIT_FEED_WALL', { + ok: false, + msg: err.message, + origBody: body + }) + } + } + /** * @param {Readonly<{ recipientPublicKey: string , token: string }>} body */ From e1fea9b4b2feaebc2348fa3b0fcd27bb4323367a Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Fri, 28 Aug 2020 22:27:42 +0200 Subject: [PATCH 2/2] complePost --- services/gunDB/contact-api/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index 39f5e1b9..74cc77b0 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -1424,7 +1424,7 @@ const createPost = async (tags, title, content) => { if (!Common.Schema.isPost(completePost)) { throw new Error( `completePost not a Post inside Actions.createPost(): ${JSON.stringify( - createPost + completePost )}` ) }