Skip to content

Commit

Permalink
HF 30 - Fix quoting, moderation editing
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Sep 6, 2024
1 parent 67d4438 commit bd590fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
22 changes: 18 additions & 4 deletions src/components/pages/Messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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};
}

Expand All @@ -1151,19 +1157,27 @@ 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,
checksum: data.checksum,
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
}]]
}

Expand Down
13 changes: 2 additions & 11 deletions src/redux/FetchDataSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit bd590fe

Please sign in to comment.