mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-29 22:37:52 +00:00
chatference, switch reference for signature
This commit is contained in:
parent
8fca4f27d4
commit
ce442dee1b
@ -1510,7 +1510,7 @@ class ChatPage extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async goToRepliedMessage(message, clickedOnMessage){
|
async goToRepliedMessage(message, clickedOnMessage){
|
||||||
const findMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(message.reference)
|
const findMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(message.signature)
|
||||||
|
|
||||||
if(findMessage){
|
if(findMessage){
|
||||||
findMessage.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
findMessage.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||||
@ -1534,7 +1534,7 @@ class ChatPage extends LitElement {
|
|||||||
|
|
||||||
|
|
||||||
if((message.timestamp - this.messagesRendered[0].timestamp) < 86400000){
|
if((message.timestamp - this.messagesRendered[0].timestamp) < 86400000){
|
||||||
const findOriginalMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(clickedOnMessage.reference)
|
const findOriginalMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(clickedOnMessage.signature)
|
||||||
if(findOriginalMessage){
|
if(findOriginalMessage){
|
||||||
const messageClientRect = findOriginalMessage.getBoundingClientRect()
|
const messageClientRect = findOriginalMessage.getBoundingClientRect()
|
||||||
this.isLoadingGoToRepliedMessage = {
|
this.isLoadingGoToRepliedMessage = {
|
||||||
@ -1546,7 +1546,7 @@ class ChatPage extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.getOldMessageDynamic(0, this.messagesRendered[0].timestamp, message.timestamp - 7200000)
|
await this.getOldMessageDynamic(0, this.messagesRendered[0].timestamp, message.timestamp - 7200000)
|
||||||
const findMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(message.reference)
|
const findMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(message.signature)
|
||||||
if(findMessage){
|
if(findMessage){
|
||||||
this.isLoadingGoToRepliedMessage = {
|
this.isLoadingGoToRepliedMessage = {
|
||||||
...this.isLoadingGoToRepliedMessage,
|
...this.isLoadingGoToRepliedMessage,
|
||||||
@ -2014,7 +2014,7 @@ class ChatPage extends LitElement {
|
|||||||
await this.getUpdateComplete();
|
await this.getUpdateComplete();
|
||||||
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
||||||
|
|
||||||
const findElement = marginElements.find((item)=> item.messageObj.reference === scrollElement.messageObj.reference)
|
const findElement = marginElements.find((item)=> item.messageObj.signature === scrollElement.messageObj.signature)
|
||||||
|
|
||||||
if(findElement){
|
if(findElement){
|
||||||
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
||||||
@ -2047,7 +2047,7 @@ class ChatPage extends LitElement {
|
|||||||
this.isLoadingOldMessages = false
|
this.isLoadingOldMessages = false
|
||||||
await this.getUpdateComplete();
|
await this.getUpdateComplete();
|
||||||
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
||||||
const findElement = marginElements.find((item)=> item.messageObj.reference === scrollElement.messageObj.reference)
|
const findElement = marginElements.find((item)=> item.messageObj.signature === scrollElement.messageObj.signature)
|
||||||
|
|
||||||
if(findElement){
|
if(findElement){
|
||||||
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
||||||
@ -2085,7 +2085,7 @@ class ChatPage extends LitElement {
|
|||||||
await this.getUpdateComplete();
|
await this.getUpdateComplete();
|
||||||
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
||||||
|
|
||||||
const findElement = marginElements.find((item)=> item.messageObj.reference === scrollElement.messageObj.reference)
|
const findElement = marginElements.find((item)=> item.messageObj.signature === scrollElement.messageObj.signature)
|
||||||
|
|
||||||
if(findElement){
|
if(findElement){
|
||||||
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
||||||
@ -2118,7 +2118,7 @@ class ChatPage extends LitElement {
|
|||||||
this.isLoadingOldMessages = false
|
this.isLoadingOldMessages = false
|
||||||
await this.getUpdateComplete();
|
await this.getUpdateComplete();
|
||||||
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
|
||||||
const findElement = marginElements.find((item)=> item.messageObj.reference === scrollElement.messageObj.reference)
|
const findElement = marginElements.find((item)=> item.messageObj.signature === scrollElement.messageObj.signature)
|
||||||
|
|
||||||
if(findElement){
|
if(findElement){
|
||||||
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
|
||||||
@ -2224,7 +2224,7 @@ class ChatPage extends LitElement {
|
|||||||
|
|
||||||
async renderNewMessage(newMessage) {
|
async renderNewMessage(newMessage) {
|
||||||
if(newMessage.chatReference){
|
if(newMessage.chatReference){
|
||||||
const findOriginalMessageIndex = this.messagesRendered.findIndex(msg=> msg.reference === newMessage.chatReference || (msg.chatReference && msg.chatReference === newMessage.chatReference) )
|
const findOriginalMessageIndex = this.messagesRendered.findIndex(msg=> msg.signature === newMessage.chatReference || (msg.chatReference && msg.chatReference === newMessage.chatReference) )
|
||||||
if(findOriginalMessageIndex !== -1){
|
if(findOriginalMessageIndex !== -1){
|
||||||
const newMessagesRendered = [...this.messagesRendered]
|
const newMessagesRendered = [...this.messagesRendered]
|
||||||
newMessagesRendered[findOriginalMessageIndex] = {...newMessage, timestamp: newMessagesRendered[findOriginalMessageIndex].timestamp, senderName: newMessagesRendered[findOriginalMessageIndex].senderName,
|
newMessagesRendered[findOriginalMessageIndex] = {...newMessage, timestamp: newMessagesRendered[findOriginalMessageIndex].timestamp, senderName: newMessagesRendered[findOriginalMessageIndex].senderName,
|
||||||
@ -2632,7 +2632,7 @@ class ChatPage extends LitElement {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
typeMessage = 'edit';
|
typeMessage = 'edit';
|
||||||
let chatReference = outSideMsg.editedMessageObj.reference;
|
let chatReference = outSideMsg.editedMessageObj.signature;
|
||||||
|
|
||||||
if(outSideMsg.editedMessageObj.chatReference){
|
if(outSideMsg.editedMessageObj.chatReference){
|
||||||
chatReference = outSideMsg.editedMessageObj.chatReference;
|
chatReference = outSideMsg.editedMessageObj.chatReference;
|
||||||
@ -2737,7 +2737,7 @@ class ChatPage extends LitElement {
|
|||||||
} else if (outSideMsg && outSideMsg.type === 'reaction') {
|
} else if (outSideMsg && outSideMsg.type === 'reaction') {
|
||||||
const userName = await getName(this.selectedAddress.address);
|
const userName = await getName(this.selectedAddress.address);
|
||||||
typeMessage = 'edit';
|
typeMessage = 'edit';
|
||||||
let chatReference = outSideMsg.editedMessageObj.reference;
|
let chatReference = outSideMsg.editedMessageObj.signature;
|
||||||
|
|
||||||
if (outSideMsg.editedMessageObj.chatReference) {
|
if (outSideMsg.editedMessageObj.chatReference) {
|
||||||
chatReference = outSideMsg.editedMessageObj.chatReference;
|
chatReference = outSideMsg.editedMessageObj.chatReference;
|
||||||
@ -2795,7 +2795,7 @@ class ChatPage extends LitElement {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (this.repliedToMessageObj) {
|
else if (this.repliedToMessageObj) {
|
||||||
let chatReference = this.repliedToMessageObj.reference;
|
let chatReference = this.repliedToMessageObj.signature;
|
||||||
if(this.repliedToMessageObj.chatReference){
|
if(this.repliedToMessageObj.chatReference){
|
||||||
chatReference = this.repliedToMessageObj.chatReference;
|
chatReference = this.repliedToMessageObj.chatReference;
|
||||||
}
|
}
|
||||||
@ -2810,7 +2810,7 @@ class ChatPage extends LitElement {
|
|||||||
this.sendMessage(stringifyMessageObject, typeMessage);
|
this.sendMessage(stringifyMessageObject, typeMessage);
|
||||||
} else if (this.editedMessageObj) {
|
} else if (this.editedMessageObj) {
|
||||||
typeMessage = 'edit'
|
typeMessage = 'edit'
|
||||||
let chatReference = this.editedMessageObj.reference
|
let chatReference = this.editedMessageObj.signature
|
||||||
|
|
||||||
if(this.editedMessageObj.chatReference){
|
if(this.editedMessageObj.chatReference){
|
||||||
chatReference = this.editedMessageObj.chatReference
|
chatReference = this.editedMessageObj.chatReference
|
||||||
|
@ -123,7 +123,7 @@ class ChatScroller extends LitElement {
|
|||||||
${formattedMessages.map((formattedMessage) => {
|
${formattedMessages.map((formattedMessage) => {
|
||||||
return repeat(
|
return repeat(
|
||||||
formattedMessage.messages,
|
formattedMessage.messages,
|
||||||
(message) => message.reference,
|
(message) => message.signature,
|
||||||
(message, indexMessage) => html`
|
(message, indexMessage) => html`
|
||||||
<message-template
|
<message-template
|
||||||
.emojiPicker=${this.emojiPicker}
|
.emojiPicker=${this.emojiPicker}
|
||||||
@ -143,7 +143,7 @@ class ChatScroller extends LitElement {
|
|||||||
.setOpenTipUser=${(val) => this.setOpenTipUser(val)}
|
.setOpenTipUser=${(val) => this.setOpenTipUser(val)}
|
||||||
.setOpenUserInfo=${(val) => this.setOpenUserInfo(val)}
|
.setOpenUserInfo=${(val) => this.setOpenUserInfo(val)}
|
||||||
.setUserName=${(val) => this.setUserName(val)}
|
.setUserName=${(val) => this.setUserName(val)}
|
||||||
id=${message.reference}
|
id=${message.signature}
|
||||||
.goToRepliedMessage=${this.goToRepliedMessage}
|
.goToRepliedMessage=${this.goToRepliedMessage}
|
||||||
.addSeenMessage=${(val)=> this.addSeenMessage(val)}
|
.addSeenMessage=${(val)=> this.addSeenMessage(val)}
|
||||||
.listSeenMessages=${this.listSeenMessages}
|
.listSeenMessages=${this.listSeenMessages}
|
||||||
@ -346,7 +346,7 @@ class MessageTemplate extends LitElement {
|
|||||||
|
|
||||||
firstUpdated(){
|
firstUpdated(){
|
||||||
const autoSeeChatList = window.parent.reduxStore.getState().app?.autoLoadImageChats
|
const autoSeeChatList = window.parent.reduxStore.getState().app?.autoLoadImageChats
|
||||||
if(autoSeeChatList.includes(this.chatId) || this.listSeenMessages.includes(this.messageObj.reference)){
|
if(autoSeeChatList.includes(this.chatId) || this.listSeenMessages.includes(this.messageObj.signature)){
|
||||||
this.viewImage = true
|
this.viewImage = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ class MessageTemplate extends LitElement {
|
|||||||
<div
|
<div
|
||||||
@click=${()=> {
|
@click=${()=> {
|
||||||
this.viewImage = true
|
this.viewImage = true
|
||||||
this.addSeenMessage(this.messageObj.reference)
|
this.addSeenMessage(this.messageObj.signature)
|
||||||
}}
|
}}
|
||||||
class=${[`image-container`, !this.isImageLoaded ? 'defaultSize' : ''].join(' ')}
|
class=${[`image-container`, !this.isImageLoaded ? 'defaultSize' : ''].join(' ')}
|
||||||
style=${this.isFirstMessage && "margin-top: 10px;"}>
|
style=${this.isFirstMessage && "margin-top: 10px;"}>
|
||||||
|
@ -659,7 +659,7 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b
|
|||||||
let messageObject = {};
|
let messageObject = {};
|
||||||
|
|
||||||
if (this.repliedToMessageObj) {
|
if (this.repliedToMessageObj) {
|
||||||
let chatReference = this.repliedToMessageObj.reference;
|
let chatReference = this.repliedToMessageObj.signature;
|
||||||
if (this.repliedToMessageObj.chatReference) {
|
if (this.repliedToMessageObj.chatReference) {
|
||||||
chatReference = this.repliedToMessageObj.chatReference;
|
chatReference = this.repliedToMessageObj.chatReference;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ export const replaceMessagesEdited = async ({
|
|||||||
}
|
}
|
||||||
const response = await parentEpml.request("apiCall", {
|
const response = await parentEpml.request("apiCall", {
|
||||||
type: "api",
|
type: "api",
|
||||||
url: `/chat/messages?chatreference=${msg.reference}&reverse=true${msgQuery}`,
|
url: `/chat/messages?chatreference=${msg.signature}&reverse=true${msgQuery}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (response && Array.isArray(response) && response.length !== 0) {
|
if (response && Array.isArray(response) && response.length !== 0) {
|
||||||
@ -52,7 +52,7 @@ export const replaceMessagesEdited = async ({
|
|||||||
if (parsedMessageObj.repliedTo) {
|
if (parsedMessageObj.repliedTo) {
|
||||||
const originalReply = await parentEpml.request("apiCall", {
|
const originalReply = await parentEpml.request("apiCall", {
|
||||||
type: "api",
|
type: "api",
|
||||||
url: `/chat/messages?reference=${parsedMessageObj.repliedTo}&reverse=true${msgQuery}`,
|
url: `/chat/messages?signature=${parsedMessageObj.repliedTo}&reverse=true${msgQuery}`,
|
||||||
})
|
})
|
||||||
const response = await parentEpml.request("apiCall", {
|
const response = await parentEpml.request("apiCall", {
|
||||||
type: "api",
|
type: "api",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user