mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-24 20:07:51 +00:00
fix bug that when a user clicks on a notification and goes back to the app it correctly show the chat page. before it would have an infinite spinner
This commit is contained in:
parent
8fca4f27d4
commit
648db552e7
@ -2,7 +2,6 @@ import { store } from '../../store.js'
|
||||
import { doPageUrl } from '../../redux/app/app-actions.js'
|
||||
|
||||
export const newMessage = (data) => {
|
||||
|
||||
const alert = playSound(data.sound)
|
||||
|
||||
// Should I show notification ?
|
||||
@ -18,7 +17,7 @@ export const newMessage = (data) => {
|
||||
}
|
||||
|
||||
notify.onclick = (e) => {
|
||||
const pageUrl = `/app/q-chat/${data.req.url}`
|
||||
const pageUrl = `/app/q-chat/?chat=${data.req.url}`
|
||||
store.dispatch(doPageUrl(pageUrl))
|
||||
}
|
||||
} else {
|
||||
@ -26,7 +25,7 @@ export const newMessage = (data) => {
|
||||
const notify = new Notification(data.title, data.options)
|
||||
|
||||
notify.onclick = (e) => {
|
||||
const pageUrl = `/app/q-chat/${data.req.url}`
|
||||
const pageUrl = `/app/q-chat/?chat=${data.req.url}`
|
||||
store.dispatch(doPageUrl(pageUrl))
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import StarterKit from '@tiptap/starter-kit'
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
import Placeholder from '@tiptap/extension-placeholder'
|
||||
import { Editor, Extension } from '@tiptap/core'
|
||||
|
||||
import Highlight from '@tiptap/extension-highlight'
|
||||
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
|
||||
|
||||
class Chat extends LitElement {
|
||||
@ -55,7 +55,7 @@ class Chat extends LitElement {
|
||||
userFoundModalOpen: { type: Boolean },
|
||||
userSelected: { type: Object },
|
||||
editor: {type: Object},
|
||||
groupInvites: { type: Array }
|
||||
groupInvites: { type: Array },
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +118,7 @@ class Chat extends LitElement {
|
||||
}
|
||||
|
||||
async connectedCallback() {
|
||||
|
||||
super.connectedCallback();
|
||||
await this.getUpdateCompleteTextEditor();
|
||||
|
||||
@ -148,14 +149,35 @@ class Chat extends LitElement {
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
this.unsubscribeStore = window.parent.reduxStore.subscribe(() => {
|
||||
try {
|
||||
|
||||
if(window.parent.location && window.parent.location.search){
|
||||
const queryString = window.parent.location.search;
|
||||
const params = new URLSearchParams(queryString);
|
||||
const chat = params.get("chat")
|
||||
if(chat && chat !== this.activeChatHeadUrl){
|
||||
let url = window.parent.location.href;
|
||||
let newUrl = url.split("?")[0];
|
||||
window.parent.history.pushState({}, "", newUrl);
|
||||
this.setActiveChatHeadUrl(chat)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.editor.destroy()
|
||||
|
||||
this.editor.destroy();
|
||||
this.unsubscribeStore();
|
||||
}
|
||||
|
||||
|
||||
updatePlaceholder(editor, text){
|
||||
editor.extensionManager.extensions.forEach((extension) => {
|
||||
if (extension.name === "placeholder") {
|
||||
@ -215,7 +237,7 @@ class Chat extends LitElement {
|
||||
</div>
|
||||
<div class="chat-history">
|
||||
|
||||
${window.parent.location.pathname !== "/app/q-chat" || this.activeChatHeadUrl ? html`${this.renderChatPage(this.chatId)}` : html`${this.renderChatWelcomePage()}`}
|
||||
${this.activeChatHeadUrl ? html`${this.renderChatPage()}` : html`${this.renderChatWelcomePage()}`}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Start Chatting Dialog -->
|
||||
@ -367,6 +389,8 @@ class Chat extends LitElement {
|
||||
`
|
||||
}
|
||||
|
||||
|
||||
|
||||
async firstUpdated() {
|
||||
this.changeLanguage();
|
||||
this.changeTheme();
|
||||
@ -482,8 +506,11 @@ class Chat extends LitElement {
|
||||
})
|
||||
})
|
||||
parentEpml.imReady()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
setOpenPrivateMessage(props) {
|
||||
this.openPrivateMessage = props.open;
|
||||
this.shadowRoot.getElementById("sendTo").value = props.name
|
||||
@ -839,7 +866,7 @@ class Chat extends LitElement {
|
||||
})
|
||||
}
|
||||
|
||||
renderChatPage(chatId) {
|
||||
renderChatPage() {
|
||||
|
||||
// Check for the chat ID from and render chat messages
|
||||
// Else render Welcome to Q-CHat
|
||||
|
Loading…
x
Reference in New Issue
Block a user