remove fixed username

This commit is contained in:
PhilReact 2023-09-14 22:22:40 -05:00
parent b2fca5a6c6
commit 063b4649b2
3 changed files with 36 additions and 11 deletions

View File

@ -126,7 +126,9 @@ class ChatPage extends LitElement {
updateMessageHash: { type: Object}, updateMessageHash: { type: Object},
oldMessages: {type: Array}, oldMessages: {type: Array},
messageQueue: {type: Array}, messageQueue: {type: Array},
isInProcessQueue: {type: Boolean} isInProcessQueue: {type: Boolean},
loggedInUserName: {type: String},
loggedInUserAddress: {type: String}
} }
} }
@ -2610,6 +2612,8 @@ class ChatPage extends LitElement {
.updateMessageHash=${this.updateMessageHash} .updateMessageHash=${this.updateMessageHash}
.clearUpdateMessageHashmap=${this.clearUpdateMessageHashmap} .clearUpdateMessageHashmap=${this.clearUpdateMessageHashmap}
.messageQueue=${this.messageQueue} .messageQueue=${this.messageQueue}
loggedInUserName=${this.loggedInUserName}
loggedInUserAddress=${this.loggedInUserAddress}
> >
</chat-scroller> </chat-scroller>
` `

View File

@ -46,6 +46,8 @@ const getApiKey = () => {
return apiKey return apiKey
} }
const extractComponents = async (url) => { const extractComponents = async (url) => {
if (!url.startsWith("qortal://")) { if (!url.startsWith("qortal://")) {
return null return null
@ -246,7 +248,9 @@ class ChatScroller extends LitElement {
disableFetching: {type: Boolean}, disableFetching: {type: Boolean},
isLoadingBefore: {type: Boolean}, isLoadingBefore: {type: Boolean},
isLoadingAfter: {type: Boolean}, isLoadingAfter: {type: Boolean},
messageQueue: {type: Array} messageQueue: {type: Array},
loggedInUserName: {type: String},
loggedInUserAddress: {type: String}
} }
} }
@ -743,13 +747,11 @@ class ChatScroller extends LitElement {
.emojiPicker=${this.emojiPicker} .emojiPicker=${this.emojiPicker}
.escapeHTML=${this.escapeHTML} .escapeHTML=${this.escapeHTML}
.messageObj=${{ .messageObj=${{
decodedMessage: message.messageText, decodedMessage: message.messageText,
"timestamp": message.timestamp,
"timestamp": message.timestamp, "sender": this.loggedInUserAddress,
"sender": "QWxEcmZxnM8yb1p92C1YKKRsp8svSVbFEs", "senderName": this.loggedInUserName,
"senderName": "palmas", "signature": "",
"signature": "4B6hHMHTnSvXTMmQb73P4Yr2o772zu7XxiTiRQv8GsgysNaoc9UCUqb9x7ihz2Su6xCREZUvgACmFpHY2gzUbYHf",
}} }}
.hideMessages=${this.hideMessages} .hideMessages=${this.hideMessages}
.setRepliedToMessageObj=${this.setRepliedToMessageObj} .setRepliedToMessageObj=${this.setRepliedToMessageObj}
@ -796,6 +798,9 @@ class ChatScroller extends LitElement {
if (changedProperties.has('userName')) { if (changedProperties.has('userName')) {
return true return true
} }
if(changedProperties.has('loggedInUserName')){
return true
}
if (changedProperties.has('updateMessageHash')) { if (changedProperties.has('updateMessageHash')) {
return true return true
} }
@ -1557,7 +1562,8 @@ class MessageTemplate extends LitElement {
</div> </div>
</div> </div>
</div> </div>
<chat-menu ${this.isInProgress ? '' : html`
<chat-menu
tabindex="0" tabindex="0"
class="chat-hover" class="chat-hover"
style="${this.showBlockAddressIcon && 'display: block;'}" style="${this.showBlockAddressIcon && 'display: block;'}"
@ -1584,6 +1590,8 @@ class MessageTemplate extends LitElement {
.gif=${!!gif} .gif=${!!gif}
> >
</chat-menu> </chat-menu>
`}
</div> </div>
<div class="message-reactions" style="${reactions.length > 0 && <div class="message-reactions" style="${reactions.length > 0 &&
'margin-top: 10px; margin-bottom: 5px;'}"> 'margin-top: 10px; margin-bottom: 5px;'}">

View File

@ -53,7 +53,9 @@ class Chat extends LitElement {
userFoundModalOpen: { type: Boolean }, userFoundModalOpen: { type: Boolean },
userSelected: { type: Object }, userSelected: { type: Object },
editor: {type: Object}, editor: {type: Object},
groupInvites: { type: Array } groupInvites: { type: Array },
loggedInUserName: {type: String},
loggedInUserAddress: {type: String},
} }
} }
@ -92,6 +94,7 @@ class Chat extends LitElement {
this.userFoundModalOpen = false this.userFoundModalOpen = false
this.userSelected = {} this.userSelected = {}
this.groupInvites = [] this.groupInvites = []
this.loggedInUserName = ""
} }
async setActiveChatHeadUrl(url) { async setActiveChatHeadUrl(url) {
@ -145,6 +148,8 @@ class Chat extends LitElement {
this.unsubscribeStore = window.parent.reduxStore.subscribe(() => { this.unsubscribeStore = window.parent.reduxStore.subscribe(() => {
try { try {
const currentState = window.parent.reduxStore.getState();
if(window.parent.location && window.parent.location.search) { if(window.parent.location && window.parent.location.search) {
const queryString = window.parent.location.search const queryString = window.parent.location.search
const params = new URLSearchParams(queryString) const params = new URLSearchParams(queryString)
@ -156,6 +161,12 @@ class Chat extends LitElement {
this.setActiveChatHeadUrl(chat) this.setActiveChatHeadUrl(chat)
} }
} }
if(currentState.app.accountInfo && currentState.app.accountInfo.names && currentState.app.accountInfo.names.length > 0 && this.loggedInUserName !== currentState.app.accountInfo.names[0].name){
this.loggedInUserName = currentState.app.accountInfo.names[0].name
}
if(currentState.app.accountInfo && currentState.app.accountInfo.addressInfo && currentState.app.accountInfo.addressInfo.address && this.loggedInUserAddress !== currentState.app.accountInfo.addressInfo.address){
this.loggedInUserAddress = currentState.app.accountInfo.addressInfo.address
}
} catch (error) { } catch (error) {
} }
}) })
@ -831,6 +842,8 @@ class Chat extends LitElement {
.setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
.setActiveChatHeadUrl=${(val)=> this.setActiveChatHeadUrl(val)} .setActiveChatHeadUrl=${(val)=> this.setActiveChatHeadUrl(val)}
balance=${this.balance} balance=${this.balance}
loggedInUserName=${this.loggedInUserName}
loggedInUserAddress=${this.loggedInUserAddress}
> >
</chat-page> </chat-page>
` `