avoid dep injection

This commit is contained in:
Daniel Lugo 2020-01-25 15:05:49 -04:00
parent f26612c0d6
commit 9769d85d76

View file

@ -4,6 +4,7 @@
const uuidv1 = require('uuid/v1') const uuidv1 = require('uuid/v1')
const LightningServices = require('../../../utils/lightningServices') const LightningServices = require('../../../utils/lightningServices')
const { getUser } = require('../Mediator')
const ErrorCode = require('./errorCode') const ErrorCode = require('./errorCode')
const Getters = require('./getters') const Getters = require('./getters')
@ -625,11 +626,7 @@ const sendMessage = async (recipientPublicKey, body, user, SEA) => {
) )
} }
const outgoingID = await Utils.recipientToOutgoingID( const outgoingID = await Utils.recipientToOutgoingID(recipientPublicKey)
recipientPublicKey,
user,
SEA
)
if (outgoingID === null) { if (outgoingID === null) {
throw new Error( throw new Error(
@ -668,10 +665,9 @@ const sendMessage = async (recipientPublicKey, body, user, SEA) => {
* @param {string} recipientPub * @param {string} recipientPub
* @param {string} msgID * @param {string} msgID
* @param {UserGUNNode} user * @param {UserGUNNode} user
* @param {ISEA} SEA
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
const deleteMessage = async (recipientPub, msgID, user, SEA) => { const deleteMessage = async (recipientPub, msgID, user) => {
if (!user.is) { if (!user.is) {
throw new Error(ErrorCode.NOT_AUTH) throw new Error(ErrorCode.NOT_AUTH)
} }
@ -700,7 +696,7 @@ const deleteMessage = async (recipientPub, msgID, user, SEA) => {
) )
} }
const outgoingID = await Utils.recipientToOutgoingID(recipientPub, user, SEA) const outgoingID = await Utils.recipientToOutgoingID(recipientPub)
if (outgoingID === null) { if (outgoingID === null) {
throw new Error(`Could not fetch an outgoing id for user: ${recipientPub}`) throw new Error(`Could not fetch an outgoing id for user: ${recipientPub}`)