4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

fix chat with less than 4 qort

This commit is contained in:
PhilReact 2023-11-06 23:19:44 +02:00
parent e6165f910d
commit 54f183778e
2 changed files with 25 additions and 24 deletions

View File

@ -334,7 +334,6 @@ class ShowPlugin extends connect(store)(LitElement) {
} }
render() { render() {
console.log('this.tabs', this.tabs)
const plugSrc = (myPlug) => { const plugSrc = (myPlug) => {
return myPlug === undefined ? 'about:blank' : `${window.location.origin}/plugin/${myPlug.domain}/${myPlug.page}${this.linkParam}` return myPlug === undefined ? 'about:blank' : `${window.location.origin}/plugin/${myPlug.domain}/${myPlug.page}${this.linkParam}`
} }

View File

@ -363,9 +363,7 @@ class ChatPage extends LitElement {
} }
this.processMessages(getInitialMessages, true, false) this.processMessages(getInitialMessages, true, false)
} catch (error) { } catch (error) { /* empty */ }
console.log
}
} }
async copyJoinGroupLinkToClipboard() { async copyJoinGroupLinkToClipboard() {
@ -681,7 +679,10 @@ class ChatPage extends LitElement {
<br> <br>
<h3 style="color: var(--black);">${translate("chatpage.cchange42")}</h3> <h3 style="color: var(--black);">${translate("chatpage.cchange42")}</h3>
<div class="buttons"> <div class="buttons">
<mwc-button @click=${() => this.sendMessage(this.myTrimmedMeassage)} dialog-confirm>${translate("transpage.tchange3")}</mwc-button> <mwc-button @click=${() => {
this.sendMessage(this.myMessageUnder4Qort)
}} dialog-confirm>${translate("transpage.tchange3")}</mwc-button>
</div> </div>
</paper-dialog> </paper-dialog>
<wrapper-modal <wrapper-modal
@ -1345,6 +1346,7 @@ class ChatPage extends LitElement {
const isRecipient = this.chatId.includes('direct') === true ? true : false const isRecipient = this.chatId.includes('direct') === true ? true : false
this.chatId.includes('direct') === true ? this.isReceipient = true : this.isReceipient = false this.chatId.includes('direct') === true ? this.isReceipient = true : this.isReceipient = false
this._chatId = this.chatId.split('/')[1] this._chatId = this.chatId.split('/')[1]
const mstring = get("chatpage.cchange8") const mstring = get("chatpage.cchange8")
const placeholder = isRecipient === true ? `Message ${this._chatId}` : `${mstring}` const placeholder = isRecipient === true ? `Message ${this._chatId}` : `${mstring}`
this.chatEditorPlaceholder = placeholder this.chatEditorPlaceholder = placeholder
@ -3113,8 +3115,8 @@ class ChatPage extends LitElement {
const stringifyMessageObject = JSON.stringify(messageObject) const stringifyMessageObject = JSON.stringify(messageObject)
if (this.balance < 4) { if (this.balance < 4) {
this.myTrimmedMeassage = '' this.myMessageUnder4Qort = null
this.myTrimmedMeassage = stringifyMessageObject this.myMessageUnder4Qort = {messageText: stringifyMessageObject, typeMessage, chatReference: undefined, isForward: false, isReceipient, _chatId, _publicKey, messageQueue}
this.shadowRoot.getElementById('confirmDialog').open() this.shadowRoot.getElementById('confirmDialog').open()
} else { } else {
return this.sendMessage({messageText: stringifyMessageObject, typeMessage, chatReference: undefined, isForward: false, isReceipient, _chatId, _publicKey, messageQueue}) return this.sendMessage({messageText: stringifyMessageObject, typeMessage, chatReference: undefined, isForward: false, isReceipient, _chatId, _publicKey, messageQueue})
@ -3164,23 +3166,23 @@ class ChatPage extends LitElement {
}) })
return _computePow(chatResponse) return _computePow(chatResponse)
} else { } else {
let groupResponse = await parentEpml.request('chat', { let groupResponse = await parentEpml.request('chat', {
type: 181, type: 181,
nonce: this.selectedAddress.nonce, nonce: this.selectedAddress.nonce,
params: { params: {
timestamp: Date.now(), timestamp: Date.now(),
groupID: Number(_chatId), groupID: Number(_chatId),
hasReceipient: 0, hasReceipient: 0,
hasChatReference: typeMessage === 'edit' ? 1 : 0, hasChatReference: typeMessage === 'edit' ? 1 : 0,
chatReference: chatReference, chatReference: chatReference,
message: messageText, message: messageText,
lastReference: reference, lastReference: reference,
proofOfWorkNonce: 0, proofOfWorkNonce: 0,
isEncrypted: 0, // Set default to not encrypted for groups isEncrypted: 0, // Set default to not encrypted for groups
isText: 1 isText: 1
} }
}) })
return _computePow(groupResponse) return _computePow(groupResponse)
} }
} }