Browse Source

flip contact to from_group=false if private msg reveived

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
b8013a5ddf
  1. 3
      api/helpers.ts
  2. 2
      api/network/receive.ts
  3. 3
      dist/api/helpers.js
  4. 2
      dist/api/helpers.js.map
  5. 2
      dist/api/network/receive.js
  6. 2
      dist/api/network/receive.js.map

3
api/helpers.ts

@ -158,6 +158,9 @@ async function parseReceiveParams(payload) {
chat = await findOrCreateChatByUUID(
chat_uuid, [parseInt(owner.id), parseInt(sender.id)]
)
if(sender.fromGroup===true) { // if a private msg received, update the contact
await sender.update({fromGroup:false})
}
} else { // group
sender = await models.Contact.findOne({ where: { publicKey: sender_pub_key } })
// inject a "sender" with an alias

2
api/network/receive.ts

@ -30,7 +30,7 @@ async function onReceive(payload){
if(isTribe && typesToForward.includes(payload.type)){
const needsPricePerJoin = typesThatNeedPricePerMessage.includes(payload.type)
const chat = await models.Chat.findOne({where:{uuid:payload.chat.uuid}})
const tribeOwnerPubKey = chat.ownerPubkey
const tribeOwnerPubKey = chat && chat.ownerPubkey
const owner = await models.Contact.findOne({where: {isOwner:true}})
if(owner.publicKey===tribeOwnerPubKey){
toAddIn.isTribeOwner = true

3
dist/api/helpers.js

@ -171,6 +171,9 @@ function parseReceiveParams(payload) {
if (isConversation) {
sender = yield findOrCreateContactByPubkey(sender_pub_key);
chat = yield findOrCreateChatByUUID(chat_uuid, [parseInt(owner.id), parseInt(sender.id)]);
if (sender.fromGroup === true) { // if a private msg received, update the contact
yield sender.update({ fromGroup: false });
}
}
else { // group
sender = yield models_1.models.Contact.findOne({ where: { publicKey: sender_pub_key } });

2
dist/api/helpers.js.map

File diff suppressed because one or more lines are too long

2
dist/api/network/receive.js

@ -40,7 +40,7 @@ function onReceive(payload) {
if (isTribe && typesToForward.includes(payload.type)) {
const needsPricePerJoin = typesThatNeedPricePerMessage.includes(payload.type);
const chat = yield models_1.models.Chat.findOne({ where: { uuid: payload.chat.uuid } });
const tribeOwnerPubKey = chat.ownerPubkey;
const tribeOwnerPubKey = chat && chat.ownerPubkey;
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
if (owner.publicKey === tribeOwnerPubKey) {
toAddIn.isTribeOwner = true;

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

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save