diff --git a/src/components/pages/Messages.jsx b/src/components/pages/Messages.jsx index feaf8ed4..f09e62ef 100644 --- a/src/components/pages/Messages.jsx +++ b/src/components/pages/Messages.jsx @@ -414,7 +414,7 @@ class Messages extends React.Component { let editInfo; if (this.editNonce) { - editInfo = { nonce: this.editNonce }; + editInfo = { from: this.editFrom, nonce: this.editNonce } } this.props.sendMessage({ @@ -616,6 +616,7 @@ class Messages extends React.Component { selectedMessages: {}, }, () => { this.editNonce = message[0].nonce; + this.editFrom = message[0].from if (message[0].message.quote) { this.setState({ replyingMessage: {quote: message[0].message.quote}, @@ -1132,7 +1133,12 @@ export default withRouter(connect( throw new Error('Unknown message type: ' + type); } } + let to = toAcc ? toAcc.name : '' if (replyingMessage) { + if (group) { + to = replyingMessage.quote.from + if (to === senderAcc.name) to = '' + } message = {...message, ...replyingMessage}; } @@ -1151,7 +1157,7 @@ export default withRouter(connect( const opData = { from: senderAcc.name, - to: toAcc ? toAcc.name : '', + to, nonce: editInfo ? editInfo.nonce : data.nonce, from_memo_key: data.from_memo_key, to_memo_key: data.to_memo_key, @@ -1159,11 +1165,19 @@ export default withRouter(connect( update: editInfo ? true : false, encrypted_message: data.encrypted_message, } - //alert(JSON.stringify(data.encrypted_message)) + alert(JSON.stringify(opData)) if (group) { + let requester + + if (editInfo && editInfo.from !== senderAcc.name) { + opData.from = editInfo.from + requester = senderAcc.name + } + opData.extensions = [[0, { - group: group.name + group: group.name, + requester }]] } diff --git a/src/redux/FetchDataSaga.js b/src/redux/FetchDataSaga.js index f04fb044..d931dbf7 100644 --- a/src/redux/FetchDataSaga.js +++ b/src/redux/FetchDataSaga.js @@ -67,7 +67,7 @@ export function* fetchState(location_change_action) { const conCache = getSpaceInCache(null, 'contacts') - if (path.startsWith('@')) { + if (path.startsWith('@') || !path) { console.time('prof: getContactsAsync') const con = yield call([auth, 'withNodeLogin'], { account, keys: { posting }, call: async (loginData) => { @@ -157,17 +157,8 @@ export function* fetchState(location_change_action) { } if (accounts.size > 0) { - let accs - if (window.accountsCache && window.uac) { - console.log('uac') - accs = window.accountsCache - } else { - console.time('prof: getAcc') - accs = yield callSafe(state, [], 'getAccountsAsync', [api, api.getAccountsAsync], Array.from(accounts), + let accs = yield callSafe(state, [], 'getAccountsAsync', [api, api.getAccountsAsync], Array.from(accounts), { current: account || '' }) - console.timeEnd('prof: getAcc') - window.accountsCache = accs - } if (hasErr) return for (let i in accs) {