Browse Source

message_price on sendMessage

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
dc1d915b7b
  1. 8
      dist/src/controllers/messages.js
  2. 2
      dist/src/controllers/messages.js.map
  3. 9
      src/controllers/messages.ts

8
dist/src/controllers/messages.js

@ -139,7 +139,7 @@ exports.sendMessage = (req, res) => __awaiter(void 0, void 0, void 0, function*
// } catch(e) {
// return failure(res, e.message)
// }
const { contact_id, text, remote_text, chat_id, remote_text_map, amount, reply_uuid, boost, } = req.body;
const { contact_id, text, remote_text, chat_id, remote_text_map, amount, reply_uuid, boost, message_price, } = req.body;
let msgtype = constants_1.default.message_types.message;
if (boost)
msgtype = constants_1.default.message_types.boost;
@ -165,12 +165,16 @@ exports.sendMessage = (req, res) => __awaiter(void 0, void 0, void 0, function*
const hasRealAmount = amount && amount > constants_1.default.min_sat_amount;
const remoteMessageContent = remote_text_map ? JSON.stringify(remote_text_map) : remote_text;
const uuid = short.generate();
let amtToStore = amount || 0;
if (boost && message_price && typeof message_price === 'number' && amount && message_price < amount) {
amtToStore = amount - message_price;
}
const msg = {
chatId: chat.id,
uuid: uuid,
type: msgtype,
sender: owner.id,
amount: amount || 0,
amount: amtToStore,
date: date,
messageContent: text,
remoteMessageContent,

2
dist/src/controllers/messages.js.map

File diff suppressed because one or more lines are too long

9
src/controllers/messages.ts

@ -158,6 +158,7 @@ export const sendMessage = async (req, res) => {
amount,
reply_uuid,
boost,
message_price,
} = req.body
let msgtype = constants.message_types.message
@ -182,19 +183,23 @@ export const sendMessage = async (req, res) => {
}})
if(ogMsg && ogMsg.sender) {
realSatsContactId = ogMsg.sender
}
}
}
const hasRealAmount = amount && amount>constants.min_sat_amount
const remoteMessageContent = remote_text_map?JSON.stringify(remote_text_map) : remote_text
const uuid = short.generate()
let amtToStore = amount || 0
if(boost && message_price && typeof message_price==='number' && amount && message_price<amount) {
amtToStore = amount - message_price
}
const msg:{[k:string]:any}={
chatId: chat.id,
uuid: uuid,
type: msgtype,
sender: owner.id,
amount: amount||0,
amount: amtToStore,
date: date,
messageContent: text,
remoteMessageContent,

Loading…
Cancel
Save