Browse Source

Merge pull request #117 from stakwork/sender_pic

Sender pic
dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
committed by GitHub
parent
commit
82a70fc858
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dist/src/controllers/bots.js
  2. 2
      dist/src/controllers/bots.js.map
  3. 6
      dist/src/controllers/chatTribes.js
  4. 2
      dist/src/controllers/chatTribes.js.map
  5. 7
      dist/src/controllers/chats.js
  6. 2
      dist/src/controllers/chats.js.map
  7. 3
      dist/src/controllers/invoices.js
  8. 2
      dist/src/controllers/invoices.js.map
  9. 3
      dist/src/controllers/media.js
  10. 2
      dist/src/controllers/media.js.map
  11. 6
      dist/src/controllers/messages.js
  12. 2
      dist/src/controllers/messages.js.map
  13. 3
      dist/src/controllers/payment.js
  14. 2
      dist/src/controllers/payment.js.map
  15. 2
      dist/src/helpers.js
  16. 2
      dist/src/helpers.js.map
  17. 4
      dist/src/models/ts/message.js
  18. 2
      dist/src/models/ts/message.js.map
  19. 2
      dist/src/network/receive.js
  20. 2
      dist/src/network/receive.js.map
  21. 8
      dist/src/network/send.js
  22. 2
      dist/src/network/send.js.map
  23. 1
      dist/src/utils/setup.js
  24. 2
      dist/src/utils/setup.js.map
  25. 2
      src/controllers/bots.ts
  26. 5
      src/controllers/chatTribes.ts
  27. 7
      src/controllers/chats.ts
  28. 5
      src/controllers/invoices.ts
  29. 5
      src/controllers/media.ts
  30. 6
      src/controllers/messages.ts
  31. 5
      src/controllers/payment.ts
  32. 2
      src/helpers.ts
  33. 3
      src/models/ts/message.ts
  34. 1
      src/network/receive.ts
  35. 4
      src/network/send.ts
  36. 2
      src/utils/setup.ts

2
dist/src/controllers/bots.js

@ -308,6 +308,7 @@ function receiveBotRes(payload) {
const action = dat.action; const action = dat.action;
const bot_name = dat.bot_name; const bot_name = dat.bot_name;
const sender_alias = dat.sender.alias; const sender_alias = dat.sender.alias;
const sender_pic = dat.sender_photo_url;
const date_string = dat.message.date; const date_string = dat.message.date;
const network_type = dat.network_type || 0; const network_type = dat.network_type || 0;
if (!chat_uuid) if (!chat_uuid)
@ -350,6 +351,7 @@ function receiveBotRes(payload) {
createdAt: date, createdAt: date,
updatedAt: date, updatedAt: date,
senderAlias: sender_alias || 'Bot', senderAlias: sender_alias || 'Bot',
senderPic: sender_pic,
network_type network_type
}; };
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);

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

File diff suppressed because one or more lines are too long

6
dist/src/controllers/chatTribes.js

@ -119,7 +119,7 @@ exports.joinTribe = joinTribe;
function receiveMemberRequest(payload) { function receiveMemberRequest(payload) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
console.log('=> receiveMemberRequest'); console.log('=> receiveMemberRequest');
const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, network_type } = yield helpers.parseReceiveParams(payload); const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } }); const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
if (!chat) if (!chat)
return console.log('no chat'); return console.log('no chat');
@ -143,6 +143,7 @@ function receiveMemberRequest(payload) {
alias: senderAlias, alias: senderAlias,
status: 1, status: 1,
fromGroup: true, fromGroup: true,
photoUrl: sender_photo_url
}); });
theSender = createdContact; theSender = createdContact;
} }
@ -178,6 +179,7 @@ function receiveMemberRequest(payload) {
}; };
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
} }
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);
const theChat = yield addPendingContactIdsToChat(chat); const theChat = yield addPendingContactIdsToChat(chat);
@ -435,7 +437,7 @@ function replayChatHistory(chat, contact) {
asyncForEach(msgs, (m) => __awaiter(this, void 0, void 0, function* () { asyncForEach(msgs, (m) => __awaiter(this, void 0, void 0, function* () {
if (!network.typesToReplay.includes(m.type)) if (!network.typesToReplay.includes(m.type))
return; // only for message for now return; // only for message for now
const sender = Object.assign(Object.assign(Object.assign({}, owner.dataValues), m.senderAlias && { alias: m.senderAlias }), { role: constants_1.default.chat_roles.reader }); const sender = Object.assign(Object.assign(Object.assign(Object.assign({}, owner.dataValues), m.senderAlias && { alias: m.senderAlias }), { role: constants_1.default.chat_roles.reader }), m.senderPic && { photoUrl: m.senderPic });
let content = ''; let content = '';
try { try {
content = JSON.parse(m.remoteMessageContent); content = JSON.parse(m.remoteMessageContent);

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

File diff suppressed because one or more lines are too long

7
dist/src/controllers/chats.js

@ -319,7 +319,7 @@ exports.deleteChat = (req, res) => __awaiter(void 0, void 0, void 0, function* (
function receiveGroupJoin(payload) { function receiveGroupJoin(payload) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
console.log('=> receiveGroupJoin'); console.log('=> receiveGroupJoin');
const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, date_string, network_type } = yield helpers.parseReceiveParams(payload); const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, date_string, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } }); const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
if (!chat) if (!chat)
return; return;
@ -353,6 +353,7 @@ function receiveGroupJoin(payload) {
alias: senderAlias, alias: senderAlias,
status: 1, status: 1,
fromGroup: true, fromGroup: true,
photoUrl: sender_photo_url
}); });
theSender = createdContact; theSender = createdContact;
contactIds.push(createdContact.id); contactIds.push(createdContact.id);
@ -392,6 +393,7 @@ function receiveGroupJoin(payload) {
}; };
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
} }
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);
const theChat = yield chatTribes_1.addPendingContactIdsToChat(chat); const theChat = yield chatTribes_1.addPendingContactIdsToChat(chat);
@ -409,7 +411,7 @@ exports.receiveGroupJoin = receiveGroupJoin;
function receiveGroupLeave(payload) { function receiveGroupLeave(payload) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
console.log('=> receiveGroupLeave'); console.log('=> receiveGroupLeave');
const { sender_pub_key, chat_uuid, chat_type, sender_alias, isTribeOwner, date_string, network_type } = yield helpers.parseReceiveParams(payload); const { sender_pub_key, chat_uuid, chat_type, sender_alias, isTribeOwner, date_string, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } }); const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
if (!chat) if (!chat)
return; return;
@ -453,6 +455,7 @@ function receiveGroupLeave(payload) {
}; };
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
} }
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);
socket.sendJson({ socket.sendJson({

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

File diff suppressed because one or more lines are too long

3
dist/src/controllers/invoices.js

@ -207,7 +207,7 @@ exports.receiveInvoice = (payload) => __awaiter(void 0, void 0, void 0, function
const network_type = dat.network_type || 0; const network_type = dat.network_type || 0;
var date = new Date(); var date = new Date();
date.setMilliseconds(0); date.setMilliseconds(0);
const { owner, sender, chat, msg_id, chat_type, sender_alias, msg_uuid } = yield helpers.parseReceiveParams(payload); const { owner, sender, chat, msg_id, chat_type, sender_alias, msg_uuid, sender_photo_url } = yield helpers.parseReceiveParams(payload);
if (!owner || !sender || !chat) { if (!owner || !sender || !chat) {
return console.log('=> no group chat!'); return console.log('=> no group chat!');
} }
@ -233,6 +233,7 @@ exports.receiveInvoice = (payload) => __awaiter(void 0, void 0, void 0, function
const isTribe = chat_type === constants_1.default.chat_types.tribe; const isTribe = chat_type === constants_1.default.chat_types.tribe;
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
} }
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);
console.log('received keysend invoice message', message.id); console.log('received keysend invoice message', message.id);

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

File diff suppressed because one or more lines are too long

3
dist/src/controllers/media.js

@ -391,7 +391,7 @@ exports.receiveAttachment = (payload) => __awaiter(void 0, void 0, void 0, funct
// console.log('received attachment', { payload }) // console.log('received attachment', { payload })
var date = new Date(); var date = new Date();
date.setMilliseconds(0); date.setMilliseconds(0);
const { owner, sender, chat, mediaToken, mediaKey, mediaType, content, msg_id, chat_type, sender_alias, msg_uuid, reply_uuid, network_type } = yield helpers.parseReceiveParams(payload); const { owner, sender, chat, mediaToken, mediaKey, mediaType, content, msg_id, chat_type, sender_alias, msg_uuid, reply_uuid, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
if (!owner || !sender || !chat) { if (!owner || !sender || !chat) {
return console.log('=> no group chat!'); return console.log('=> no group chat!');
} }
@ -418,6 +418,7 @@ exports.receiveAttachment = (payload) => __awaiter(void 0, void 0, void 0, funct
const isTribe = chat_type === constants_1.default.chat_types.tribe; const isTribe = chat_type === constants_1.default.chat_types.tribe;
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
} }
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);
// console.log('saved attachment', message.dataValues) // console.log('saved attachment', message.dataValues)

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

File diff suppressed because one or more lines are too long

6
dist/src/controllers/messages.js

@ -217,7 +217,7 @@ exports.sendMessage = (req, res) => __awaiter(void 0, void 0, void 0, function*
}); });
exports.receiveMessage = (payload) => __awaiter(void 0, void 0, void 0, function* () { exports.receiveMessage = (payload) => __awaiter(void 0, void 0, void 0, function* () {
// console.log('received message', { payload }) // console.log('received message', { payload })
const { owner, sender, chat, content, remote_content, msg_id, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type } = yield helpers.parseReceiveParams(payload); const { owner, sender, chat, content, remote_content, msg_id, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
if (!owner || !sender || !chat) { if (!owner || !sender || !chat) {
return console.log('=> no group chat!'); return console.log('=> no group chat!');
} }
@ -242,6 +242,7 @@ exports.receiveMessage = (payload) => __awaiter(void 0, void 0, void 0, function
const isTribe = chat_type === constants_1.default.chat_types.tribe; const isTribe = chat_type === constants_1.default.chat_types.tribe;
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
if (remote_content) if (remote_content)
msg.remoteMessageContent = remote_content; msg.remoteMessageContent = remote_content;
} }
@ -257,7 +258,7 @@ exports.receiveMessage = (payload) => __awaiter(void 0, void 0, void 0, function
confirmations_1.sendConfirmation({ chat: theChat, sender: owner, msg_id }); confirmations_1.sendConfirmation({ chat: theChat, sender: owner, msg_id });
}); });
exports.receiveBoost = (payload) => __awaiter(void 0, void 0, void 0, function* () { exports.receiveBoost = (payload) => __awaiter(void 0, void 0, void 0, function* () {
const { owner, sender, chat, content, remote_content, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type } = yield helpers.parseReceiveParams(payload); const { owner, sender, chat, content, remote_content, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
console.log('=> received boost ' + amount + ' sats on network:', network_type); console.log('=> received boost ' + amount + ' sats on network:', network_type);
if (!owner || !sender || !chat) { if (!owner || !sender || !chat) {
return console.log('=> no group chat!'); return console.log('=> no group chat!');
@ -283,6 +284,7 @@ exports.receiveBoost = (payload) => __awaiter(void 0, void 0, void 0, function*
const isTribe = chat_type === constants_1.default.chat_types.tribe; const isTribe = chat_type === constants_1.default.chat_types.tribe;
if (isTribe) { if (isTribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
if (remote_content) if (remote_content)
msg.remoteMessageContent = remote_content; msg.remoteMessageContent = remote_content;
} }

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

File diff suppressed because one or more lines are too long

3
dist/src/controllers/payment.js

@ -116,7 +116,7 @@ exports.receivePayment = (payload) => __awaiter(void 0, void 0, void 0, function
console.log('received payment', { payload }); console.log('received payment', { payload });
var date = new Date(); var date = new Date();
date.setMilliseconds(0); date.setMilliseconds(0);
const { owner, sender, chat, amount, content, mediaType, mediaToken, chat_type, sender_alias, msg_uuid, reply_uuid, network_type } = yield helpers.parseReceiveParams(payload); const { owner, sender, chat, amount, content, mediaType, mediaToken, chat_type, sender_alias, msg_uuid, reply_uuid, network_type, sender_photo_url } = yield helpers.parseReceiveParams(payload);
if (!owner || !sender || !chat) { if (!owner || !sender || !chat) {
return console.log('=> no group chat!'); return console.log('=> no group chat!');
} }
@ -140,6 +140,7 @@ exports.receivePayment = (payload) => __awaiter(void 0, void 0, void 0, function
msg.mediaToken = mediaToken; msg.mediaToken = mediaToken;
if (chat_type === constants_1.default.chat_types.tribe) { if (chat_type === constants_1.default.chat_types.tribe) {
msg.senderAlias = sender_alias; msg.senderAlias = sender_alias;
msg.senderPic = sender_photo_url;
} }
if (reply_uuid) if (reply_uuid)
msg.replyUuid = reply_uuid; msg.replyUuid = reply_uuid;

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

File diff suppressed because one or more lines are too long

2
dist/src/helpers.js

@ -148,7 +148,7 @@ function parseReceiveParams(payload) {
const dat = payload.content || payload; const dat = payload.content || payload;
const sender_pub_key = dat.sender.pub_key; const sender_pub_key = dat.sender.pub_key;
const sender_alias = dat.sender.alias; const sender_alias = dat.sender.alias;
const sender_photo_url = dat.sender.photo_url; const sender_photo_url = dat.sender.photo_url || '';
const chat_uuid = dat.chat.uuid; const chat_uuid = dat.chat.uuid;
const chat_type = dat.chat.type; const chat_type = dat.chat.type;
const chat_members = dat.chat.members || {}; const chat_members = dat.chat.members || {};

2
dist/src/helpers.js.map

File diff suppressed because one or more lines are too long

4
dist/src/models/ts/message.js

@ -121,6 +121,10 @@ __decorate([
sequelize_typescript_1.Column, sequelize_typescript_1.Column,
__metadata("design:type", String) __metadata("design:type", String)
], Message.prototype, "senderAlias", void 0); ], Message.prototype, "senderAlias", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], Message.prototype, "senderPic", void 0);
__decorate([ __decorate([
sequelize_typescript_1.Column, sequelize_typescript_1.Column,
__metadata("design:type", String) __metadata("design:type", String)

2
dist/src/models/ts/message.js.map

@ -1 +1 @@
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../src/models/ts/message.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,OAAO,GAA5B,MAAqB,OAAQ,SAAQ,4BAAc;CA8FlD,CAAA;AAtFC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC;;mCACQ;AAGV;IADC,6BAAM;;qCACK;AAGZ;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;qCACZ;AAGZ;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;yCACR;AAGhB;IADC,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;uCACX;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;2CACP;AAGlB;IADC,6BAAM;;4CACY;AAGnB;IADC,6BAAM,CAAC,+B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CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;;4CACY;AAGnB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;6CACa;AAGpB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;6CACL;AAhGD,OAAO;IAD3B,4BAAK,CAAC,EAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACpC,OAAO,CAiG3B;kBAjGoB,OAAO"}

2
dist/src/network/receive.js

@ -230,7 +230,7 @@ function forwardMessageToTribe(ogpayload, sender, realSatsContactId, amtToForwar
// ASK xref TABLE and put alias there too? // ASK xref TABLE and put alias there too?
send_1.sendMessage({ send_1.sendMessage({
type, message, type, message,
sender: Object.assign(Object.assign(Object.assign({}, owner.dataValues), payload.sender && payload.sender.alias && { alias: payload.sender.alias }), { role: constants_1.default.chat_roles.reader }), sender: Object.assign(Object.assign(Object.assign(Object.assign({}, owner.dataValues), payload.sender && payload.sender.alias && { alias: payload.sender.alias }), payload.sender && payload.sender.photo_url && { photoUrl: payload.sender.photo_url }), { role: constants_1.default.chat_roles.reader }),
amount: amtToForwardToRealSatsContactId || 0, amount: amtToForwardToRealSatsContactId || 0,
chat: chat, chat: chat,
skipPubKey: payload.sender.pub_key, skipPubKey: payload.sender.pub_key,

2
dist/src/network/receive.js.map

File diff suppressed because one or more lines are too long

8
dist/src/network/send.js

@ -167,16 +167,12 @@ function checkIfAutoConfirm(data) {
function newmsg(type, chat, sender, message) { function newmsg(type, chat, sender, message) {
const includeGroupKey = type === constants_1.default.message_types.group_create || type === constants_1.default.message_types.group_invite; const includeGroupKey = type === constants_1.default.message_types.group_create || type === constants_1.default.message_types.group_invite;
const includeAlias = sender && sender.alias && chat.type === constants_1.default.chat_types.tribe; const includeAlias = sender && sender.alias && chat.type === constants_1.default.chat_types.tribe;
// const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type === constants_1.default.chat_types.tribe;
return { return {
type: type, type: type,
chat: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ uuid: chat.uuid }, chat.name && { name: chat.name }), (chat.type || chat.type === 0) && { type: chat.type }), chat.members && { members: chat.members }), (includeGroupKey && chat.groupKey) && { groupKey: chat.groupKey }), (includeGroupKey && chat.host) && { host: chat.host }), chat: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ uuid: chat.uuid }, chat.name && { name: chat.name }), (chat.type || chat.type === 0) && { type: chat.type }), chat.members && { members: chat.members }), (includeGroupKey && chat.groupKey) && { groupKey: chat.groupKey }), (includeGroupKey && chat.host) && { host: chat.host }),
message: message, message: message,
sender: { sender: Object.assign({ pub_key: sender.publicKey, alias: includeAlias ? sender.alias : '', role: sender.role || constants_1.default.chat_roles.reader }, includePhotoUrl && { photo_url: sender.photoUrl })
pub_key: sender.publicKey,
alias: includeAlias ? sender.alias : '',
role: sender.role || constants_1.default.chat_roles.reader,
}
}; };
} }
exports.newmsg = newmsg; exports.newmsg = newmsg;

2
dist/src/network/send.js.map

File diff suppressed because one or more lines are too long

1
dist/src/utils/setup.js

@ -49,6 +49,7 @@ function setVersion() {
} }
function migrate() { function migrate() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
addTableColumn('sphinx_messages', 'sender_pic');
addTableColumn('sphinx_messages', 'network_type', 'INTEGER'); addTableColumn('sphinx_messages', 'network_type', 'INTEGER');
addTableColumn('sphinx_chats', 'meta'); addTableColumn('sphinx_chats', 'meta');
addTableColumn('sphinx_contacts', 'tip_amount', 'BIGINT'); addTableColumn('sphinx_contacts', 'tip_amount', 'BIGINT');

2
dist/src/utils/setup.js.map

File diff suppressed because one or more lines are too long

2
src/controllers/bots.ts

@ -298,6 +298,7 @@ export async function receiveBotRes(payload) {
const action = dat.action const action = dat.action
const bot_name = dat.bot_name const bot_name = dat.bot_name
const sender_alias = dat.sender.alias const sender_alias = dat.sender.alias
const sender_pic = dat.sender_photo_url
const date_string = dat.message.date const date_string = dat.message.date
const network_type = dat.network_type||0 const network_type = dat.network_type||0
@ -341,6 +342,7 @@ export async function receiveBotRes(payload) {
createdAt: date, createdAt: date,
updatedAt: date, updatedAt: date,
senderAlias: sender_alias || 'Bot', senderAlias: sender_alias || 'Bot',
senderPic: sender_pic,
network_type network_type
} }
const message = await models.Message.create(msg) const message = await models.Message.create(msg)

5
src/controllers/chatTribes.ts

@ -114,7 +114,7 @@ export async function joinTribe(req, res){
export async function receiveMemberRequest(payload) { export async function receiveMemberRequest(payload) {
console.log('=> receiveMemberRequest') console.log('=> receiveMemberRequest')
const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, network_type } = await helpers.parseReceiveParams(payload) const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, network_type, sender_photo_url } = await helpers.parseReceiveParams(payload)
const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } }) const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
if (!chat) return console.log('no chat') if (!chat) return console.log('no chat')
@ -140,6 +140,7 @@ export async function receiveMemberRequest(payload) {
alias: senderAlias, alias: senderAlias,
status: 1, status: 1,
fromGroup: true, fromGroup: true,
photoUrl: sender_photo_url
}) })
theSender = createdContact theSender = createdContact
} }
@ -175,6 +176,7 @@ export async function receiveMemberRequest(payload) {
} }
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
} }
const message = await models.Message.create(msg) const message = await models.Message.create(msg)
@ -438,6 +440,7 @@ export async function replayChatHistory(chat, contact) {
...owner.dataValues, ...owner.dataValues,
...m.senderAlias && {alias: m.senderAlias}, ...m.senderAlias && {alias: m.senderAlias},
role: constants.chat_roles.reader, role: constants.chat_roles.reader,
...m.senderPic && {photoUrl: m.senderPic}
} }
let content = '' let content = ''
try {content = JSON.parse(m.remoteMessageContent)} catch(e) {} try {content = JSON.parse(m.remoteMessageContent)} catch(e) {}

7
src/controllers/chats.ts

@ -324,7 +324,7 @@ export const deleteChat = async (req, res) => {
export async function receiveGroupJoin(payload) { export async function receiveGroupJoin(payload) {
console.log('=> receiveGroupJoin') console.log('=> receiveGroupJoin')
const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, date_string, network_type } = await helpers.parseReceiveParams(payload) const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, date_string, network_type, sender_photo_url } = await helpers.parseReceiveParams(payload)
const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } }) const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
if (!chat) return if (!chat) return
@ -359,6 +359,7 @@ export async function receiveGroupJoin(payload) {
alias: senderAlias, alias: senderAlias,
status: 1, status: 1,
fromGroup: true, fromGroup: true,
photoUrl: sender_photo_url
}) })
theSender = createdContact theSender = createdContact
contactIds.push(createdContact.id) contactIds.push(createdContact.id)
@ -399,6 +400,7 @@ export async function receiveGroupJoin(payload) {
} }
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
} }
const message = await models.Message.create(msg) const message = await models.Message.create(msg)
@ -415,7 +417,7 @@ export async function receiveGroupJoin(payload) {
export async function receiveGroupLeave(payload) { export async function receiveGroupLeave(payload) {
console.log('=> receiveGroupLeave') console.log('=> receiveGroupLeave')
const { sender_pub_key, chat_uuid, chat_type, sender_alias, isTribeOwner, date_string, network_type } = await helpers.parseReceiveParams(payload) const { sender_pub_key, chat_uuid, chat_type, sender_alias, isTribeOwner, date_string, network_type, sender_photo_url } = await helpers.parseReceiveParams(payload)
const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } }) const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
if (!chat) return if (!chat) return
@ -461,6 +463,7 @@ export async function receiveGroupLeave(payload) {
} }
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
} }
const message = await models.Message.create(msg) const message = await models.Message.create(msg)

5
src/controllers/invoices.ts

@ -225,7 +225,7 @@ export const receiveInvoice = async (payload) => {
var date = new Date(); var date = new Date();
date.setMilliseconds(0) date.setMilliseconds(0)
const { owner, sender, chat, msg_id, chat_type, sender_alias, msg_uuid } = await helpers.parseReceiveParams(payload) const { owner, sender, chat, msg_id, chat_type, sender_alias, msg_uuid, sender_photo_url } = await helpers.parseReceiveParams(payload)
if (!owner || !sender || !chat) { if (!owner || !sender || !chat) {
return console.log('=> no group chat!') return console.log('=> no group chat!')
} }
@ -252,7 +252,8 @@ export const receiveInvoice = async (payload) => {
} }
const isTribe = chat_type===constants.chat_types.tribe const isTribe = chat_type===constants.chat_types.tribe
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
} }
const message = await models.Message.create(msg) const message = await models.Message.create(msg)
console.log('received keysend invoice message', message.id) console.log('received keysend invoice message', message.id)

5
src/controllers/media.ts

@ -429,7 +429,7 @@ export const receiveAttachment = async (payload) => {
var date = new Date(); var date = new Date();
date.setMilliseconds(0) date.setMilliseconds(0)
const {owner, sender, chat, mediaToken, mediaKey, mediaType, content, msg_id, chat_type, sender_alias, msg_uuid, reply_uuid, network_type} = await helpers.parseReceiveParams(payload) const {owner, sender, chat, mediaToken, mediaKey, mediaType, content, msg_id, chat_type, sender_alias, msg_uuid, reply_uuid, network_type, sender_photo_url} = await helpers.parseReceiveParams(payload)
if(!owner || !sender || !chat) { if(!owner || !sender || !chat) {
return console.log('=> no group chat!') return console.log('=> no group chat!')
} }
@ -451,7 +451,8 @@ export const receiveAttachment = async (payload) => {
if(reply_uuid) msg.replyUuid = reply_uuid if(reply_uuid) msg.replyUuid = reply_uuid
const isTribe = chat_type===constants.chat_types.tribe const isTribe = chat_type===constants.chat_types.tribe
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
} }
const message = await models.Message.create(msg) const message = await models.Message.create(msg)

6
src/controllers/messages.ts

@ -244,7 +244,7 @@ export const sendMessage = async (req, res) => {
export const receiveMessage = async (payload) => { export const receiveMessage = async (payload) => {
// console.log('received message', { payload }) // console.log('received message', { payload })
const {owner, sender, chat, content, remote_content, msg_id, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type} = await helpers.parseReceiveParams(payload) const {owner, sender, chat, content, remote_content, msg_id, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type, sender_photo_url} = await helpers.parseReceiveParams(payload)
if(!owner || !sender || !chat) { if(!owner || !sender || !chat) {
return console.log('=> no group chat!') return console.log('=> no group chat!')
} }
@ -270,6 +270,7 @@ export const receiveMessage = async (payload) => {
const isTribe = chat_type===constants.chat_types.tribe const isTribe = chat_type===constants.chat_types.tribe
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
if(remote_content) msg.remoteMessageContent=remote_content if(remote_content) msg.remoteMessageContent=remote_content
} }
if(reply_uuid) msg.replyUuid = reply_uuid if(reply_uuid) msg.replyUuid = reply_uuid
@ -287,7 +288,7 @@ export const receiveMessage = async (payload) => {
} }
export const receiveBoost = async (payload) => { export const receiveBoost = async (payload) => {
const {owner, sender, chat, content, remote_content, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type} = await helpers.parseReceiveParams(payload) const {owner, sender, chat, content, remote_content, chat_type, sender_alias, msg_uuid, date_string, reply_uuid, amount, network_type, sender_photo_url} = await helpers.parseReceiveParams(payload)
console.log('=> received boost ' +amount+ ' sats on network:', network_type) console.log('=> received boost ' +amount+ ' sats on network:', network_type)
if(!owner || !sender || !chat) { if(!owner || !sender || !chat) {
return console.log('=> no group chat!') return console.log('=> no group chat!')
@ -314,6 +315,7 @@ export const receiveBoost = async (payload) => {
const isTribe = chat_type===constants.chat_types.tribe const isTribe = chat_type===constants.chat_types.tribe
if(isTribe) { if(isTribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
if(remote_content) msg.remoteMessageContent=remote_content if(remote_content) msg.remoteMessageContent=remote_content
} }
if(reply_uuid) msg.replyUuid = reply_uuid if(reply_uuid) msg.replyUuid = reply_uuid

5
src/controllers/payment.ts

@ -129,7 +129,7 @@ export const receivePayment = async (payload) => {
var date = new Date(); var date = new Date();
date.setMilliseconds(0) date.setMilliseconds(0)
const {owner, sender, chat, amount, content, mediaType, mediaToken, chat_type, sender_alias, msg_uuid, reply_uuid, network_type} = await helpers.parseReceiveParams(payload) const {owner, sender, chat, amount, content, mediaType, mediaToken, chat_type, sender_alias, msg_uuid, reply_uuid, network_type, sender_photo_url} = await helpers.parseReceiveParams(payload)
if(!owner || !sender || !chat) { if(!owner || !sender || !chat) {
return console.log('=> no group chat!') return console.log('=> no group chat!')
} }
@ -150,7 +150,8 @@ export const receivePayment = async (payload) => {
if(mediaType) msg.mediaType = mediaType if(mediaType) msg.mediaType = mediaType
if(mediaToken) msg.mediaToken = mediaToken if(mediaToken) msg.mediaToken = mediaToken
if(chat_type===constants.chat_types.tribe) { if(chat_type===constants.chat_types.tribe) {
msg.senderAlias = sender_alias msg.senderAlias = sender_alias
msg.senderPic = sender_photo_url
} }
if(reply_uuid) msg.replyUuid = reply_uuid if(reply_uuid) msg.replyUuid = reply_uuid

2
src/helpers.ts

@ -134,7 +134,7 @@ export async function parseReceiveParams(payload) {
const dat = payload.content || payload const dat = payload.content || payload
const sender_pub_key = dat.sender.pub_key const sender_pub_key = dat.sender.pub_key
const sender_alias = dat.sender.alias const sender_alias = dat.sender.alias
const sender_photo_url = dat.sender.photo_url const sender_photo_url = dat.sender.photo_url || ''
const chat_uuid = dat.chat.uuid const chat_uuid = dat.chat.uuid
const chat_type = dat.chat.type const chat_type = dat.chat.type
const chat_members: { [k: string]: any } = dat.chat.members || {} const chat_members: { [k: string]: any } = dat.chat.members || {}

3
src/models/ts/message.ts

@ -87,6 +87,9 @@ export default class Message extends Model<Message> {
@Column @Column
senderAlias: string // for tribes, no "sender" id maybe senderAlias: string // for tribes, no "sender" id maybe
@Column
senderPic: string // for tribes, no "sender" id maybe
@Column @Column
originalMuid: string // for tribe, remember the og muid originalMuid: string // for tribe, remember the og muid

1
src/network/receive.ts

@ -214,6 +214,7 @@ async function forwardMessageToTribe(ogpayload, sender, realSatsContactId, amtTo
sender: { sender: {
...owner.dataValues, ...owner.dataValues,
...payload.sender&&payload.sender.alias && {alias:payload.sender.alias}, ...payload.sender&&payload.sender.alias && {alias:payload.sender.alias},
...payload.sender&&payload.sender.photo_url && {photoUrl:payload.sender.photo_url}, // camelcase here, this is usually the "sender" from DB
role: constants.chat_roles.reader, role: constants.chat_roles.reader,
}, },
amount: amtToForwardToRealSatsContactId||0, amount: amtToForwardToRealSatsContactId||0,

4
src/network/send.ts

@ -159,7 +159,7 @@ function checkIfAutoConfirm(data){
export function newmsg(type, chat, sender, message){ export function newmsg(type, chat, sender, message){
const includeGroupKey = type===constants.message_types.group_create || type===constants.message_types.group_invite const includeGroupKey = type===constants.message_types.group_create || type===constants.message_types.group_invite
const includeAlias = sender && sender.alias && chat.type===constants.chat_types.tribe const includeAlias = sender && sender.alias && chat.type===constants.chat_types.tribe
// const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type===constants.chat_types.tribe
return { return {
type: type, type: type,
chat: { chat: {
@ -175,7 +175,7 @@ export function newmsg(type, chat, sender, message){
pub_key: sender.publicKey, pub_key: sender.publicKey,
alias: includeAlias ? sender.alias : '', alias: includeAlias ? sender.alias : '',
role: sender.role || constants.chat_roles.reader, role: sender.role || constants.chat_roles.reader,
// ...includePhotoUrl && {photo_url: sender.photoUrl}, ...includePhotoUrl && {photo_url: sender.photoUrl},
// ...sender.contactKey && {contact_key: sender.contactKey} // ...sender.contactKey && {contact_key: sender.contactKey}
} }
} }

2
src/utils/setup.ts

@ -38,6 +38,8 @@ async function setVersion() {
async function migrate() { async function migrate() {
addTableColumn('sphinx_messages', 'sender_pic')
addTableColumn('sphinx_messages', 'network_type', 'INTEGER') addTableColumn('sphinx_messages', 'network_type', 'INTEGER')
addTableColumn('sphinx_chats', 'meta') addTableColumn('sphinx_chats', 'meta')

Loading…
Cancel
Save