Browse Source

dont send the unique alias/pic if u are tribe admin and forwarding

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
9500436220
  1. 3
      dist/src/controllers/chatTribes.js
  2. 2
      dist/src/controllers/chatTribes.js.map
  3. 8
      dist/src/network/send.js
  4. 2
      dist/src/network/send.js.map
  5. 3
      src/controllers/chatTribes.ts
  6. 8
      src/network/send.ts

3
dist/src/controllers/chatTribes.js

@ -462,7 +462,8 @@ function replayChatHistory(chat, contact) {
} }
} }
} }
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign(Object.assign({ content }, mediaKeyMap && { mediaKey: mediaKeyMap }), newMediaTerms && { mediaToken: newMediaTerms }), m.mediaType && { mediaType: m.mediaType }), dateString && { date: dateString })); const isForwarded = true;
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign(Object.assign({ content }, mediaKeyMap && { mediaKey: mediaKeyMap }), newMediaTerms && { mediaToken: newMediaTerms }), m.mediaType && { mediaType: m.mediaType }), dateString && { date: dateString }), isForwarded);
msg = yield msg_1.decryptMessage(msg, chat); msg = yield msg_1.decryptMessage(msg, chat);
const data = yield msg_1.personalizeMessage(msg, contact, true); const data = yield msg_1.personalizeMessage(msg, contact, true);
const mqttTopic = `${contact.publicKey}/${chat.uuid}`; const mqttTopic = `${contact.publicKey}/${chat.uuid}`;

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

File diff suppressed because one or more lines are too long

8
dist/src/network/send.js

@ -29,7 +29,7 @@ function sendMessage(params) {
if (isTribeOwner && !isForwarded) { if (isTribeOwner && !isForwarded) {
theSender = Object.assign(Object.assign({}, (sender.dataValues || sender)), { role: constants_1.default.chat_roles.owner }); theSender = Object.assign(Object.assign({}, (sender.dataValues || sender)), { role: constants_1.default.chat_roles.owner });
} }
let msg = newmsg(type, chat, theSender, message); let msg = newmsg(type, chat, theSender, message, isForwarded);
// console.log("=> MSG TO SEND",msg) // console.log("=> MSG TO SEND",msg)
// console.log(type,message) // console.log(type,message)
if (!(sender && sender.publicKey)) { if (!(sender && sender.publicKey)) {
@ -164,16 +164,16 @@ function checkIfAutoConfirm(data) {
confirmations_1.tribeOwnerAutoConfirmation(data.message.id, data.chat.uuid); confirmations_1.tribeOwnerAutoConfirmation(data.message.id, data.chat.uuid);
} }
} }
function newmsg(type, chat, sender, message) { function newmsg(type, chat, sender, message, isForwarded) {
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;
let aliasToInclude = sender.alias; let aliasToInclude = sender.alias;
if (includeAlias && chat.myAlias) { if (!isForwarded && includeAlias && chat.myAlias) {
aliasToInclude = chat.myAlias; aliasToInclude = chat.myAlias;
} }
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type === constants_1.default.chat_types.tribe; const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type === constants_1.default.chat_types.tribe;
let photoUrlToInclude = sender.photoUrl; let photoUrlToInclude = sender.photoUrl;
if (includePhotoUrl && chat.myPhotoUrl) { if (!isForwarded && includePhotoUrl && chat.myPhotoUrl) {
photoUrlToInclude = chat.myPhotoUrl; photoUrlToInclude = chat.myPhotoUrl;
} }
return { return {

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

File diff suppressed because one or more lines are too long

3
src/controllers/chatTribes.ts

@ -464,13 +464,14 @@ export async function replayChatHistory(chat, contact) {
} }
} }
} }
const isForwarded = true
let msg = network.newmsg(m.type, chat, sender, { let msg = network.newmsg(m.type, chat, sender, {
content, // replaced with the remoteMessageContent (u are owner) {} content, // replaced with the remoteMessageContent (u are owner) {}
...mediaKeyMap && {mediaKey: mediaKeyMap}, ...mediaKeyMap && {mediaKey: mediaKeyMap},
...newMediaTerms && {mediaToken: newMediaTerms}, ...newMediaTerms && {mediaToken: newMediaTerms},
...m.mediaType && {mediaType: m.mediaType}, ...m.mediaType && {mediaType: m.mediaType},
...dateString && {date: dateString} ...dateString && {date: dateString}
}) }, isForwarded)
msg = await decryptMessage(msg, chat) msg = await decryptMessage(msg, chat)
const data = await personalizeMessage(msg, contact, true) const data = await personalizeMessage(msg, contact, true)
const mqttTopic = `${contact.publicKey}/${chat.uuid}` const mqttTopic = `${contact.publicKey}/${chat.uuid}`

8
src/network/send.ts

@ -21,7 +21,7 @@ export async function sendMessage(params) {
if(isTribeOwner && !isForwarded) { if(isTribeOwner && !isForwarded) {
theSender = {...(sender.dataValues||sender), role:constants.chat_roles.owner} theSender = {...(sender.dataValues||sender), role:constants.chat_roles.owner}
} }
let msg = newmsg(type, chat, theSender, message) let msg = newmsg(type, chat, theSender, message, isForwarded)
// console.log("=> MSG TO SEND",msg) // console.log("=> MSG TO SEND",msg)
@ -156,16 +156,16 @@ function checkIfAutoConfirm(data){
} }
} }
export function newmsg(type, chat, sender, message){ export function newmsg(type, chat, sender, message, isForwarded:boolean){
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
let aliasToInclude = sender.alias let aliasToInclude = sender.alias
if(includeAlias && chat.myAlias) { if(!isForwarded && includeAlias && chat.myAlias) {
aliasToInclude = chat.myAlias aliasToInclude = chat.myAlias
} }
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type===constants.chat_types.tribe const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type===constants.chat_types.tribe
let photoUrlToInclude = sender.photoUrl let photoUrlToInclude = sender.photoUrl
if(includePhotoUrl && chat.myPhotoUrl) { if(!isForwarded && includePhotoUrl && chat.myPhotoUrl) {
photoUrlToInclude = chat.myPhotoUrl photoUrlToInclude = chat.myPhotoUrl
} }
return { return {

Loading…
Cancel
Save