Browse Source

fix replay tribe uuid

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

4
dist/src/controllers/chatTribes.js

@ -477,7 +477,9 @@ function replayChatHistory(chat, contact) {
} }
} }
const isForwarded = m.sender !== 1; const isForwarded = m.sender !== 1;
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign(Object.assign({ content, uuid: m.uuid, status: m.status }, mediaKeyMap && { mediaKey: mediaKeyMap }), newMediaTerms && { mediaToken: newMediaTerms }), m.mediaType && { mediaType: m.mediaType }), dateString && { date: dateString }), isForwarded); const includeStatus = true;
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign(Object.assign({ content, uuid: m.uuid, replyUuid: m.replyUuid, status: m.status }, mediaKeyMap && { mediaKey: mediaKeyMap }), newMediaTerms && { mediaToken: newMediaTerms }), m.mediaType && { mediaType: m.mediaType }), dateString && { date: dateString }), isForwarded, includeStatus);
console.log("=====> A MESSAGE TO SEND", msg);
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

5
dist/src/network/send.js

@ -164,7 +164,7 @@ 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, isForwarded) { function newmsg(type, chat, sender, message, isForwarded, includeStatus) {
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;
@ -176,6 +176,9 @@ function newmsg(type, chat, sender, message, isForwarded) {
if (!isForwarded && includePhotoUrl && chat.myPhotoUrl) { if (!isForwarded && includePhotoUrl && chat.myPhotoUrl) {
photoUrlToInclude = chat.myPhotoUrl; photoUrlToInclude = chat.myPhotoUrl;
} }
if (!includeStatus && message.status) {
delete message.status;
}
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 }),

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

File diff suppressed because one or more lines are too long

5
src/controllers/chatTribes.ts

@ -475,15 +475,18 @@ export async function replayChatHistory(chat, contact) {
} }
} }
const isForwarded = m.sender!==1 const isForwarded = m.sender!==1
const includeStatus = 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) {}
uuid: m.uuid, uuid: m.uuid,
replyUuid: m.replyUuid,
status: m.status, status: m.status,
...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) }, isForwarded, includeStatus)
console.log("=====> A MESSAGE TO SEND",msg)
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}`

5
src/network/send.ts

@ -156,7 +156,7 @@ function checkIfAutoConfirm(data){
} }
} }
export function newmsg(type, chat, sender, message, isForwarded:boolean){ export function newmsg(type, chat, sender, message, isForwarded:boolean, includeStatus?: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
@ -168,6 +168,9 @@ export function newmsg(type, chat, sender, message, isForwarded:boolean){
if(!isForwarded && includePhotoUrl && chat.myPhotoUrl) { if(!isForwarded && includePhotoUrl && chat.myPhotoUrl) {
photoUrlToInclude = chat.myPhotoUrl photoUrlToInclude = chat.myPhotoUrl
} }
if(!includeStatus && message.status) {
delete message.status
}
return { return {
type: type, type: type,
chat: { chat: {

Loading…
Cancel
Save