From 2e5cc014523034c1461deb01fbc0c228187b7b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Iv=C3=A1n=20Vieitez=20Parra?= <3857362+corrideat@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:31:15 +0200 Subject: [PATCH 1/4] Handle unhandled promise rejection. Closes #2473. (#2501) --- frontend/controller/app/identity.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/controller/app/identity.js b/frontend/controller/app/identity.js index dc0bc521d..6b9cacf35 100644 --- a/frontend/controller/app/identity.js +++ b/frontend/controller/app/identity.js @@ -390,6 +390,16 @@ export default (sbp('sbp/selectors/register', { try { await sbp('chelonia/contract/sync', identityContractID) } catch (e) { + // Since we're throwing or returning, the `await` below will not + // be used. In either case, login won't complete after this point, + // so errors there aren't relevant anymore. + loginCompletePromise.catch((e) => { + // Using `warn` level because this error is not so relevant + // However, errors might be helpful for debugging purposes, so + // we still log it. + console.warn('[gi.app/identity/login] Error in login complete promise', e) + }) + // To make it easier to test things during development, if the // identity contract no longer exists, we automatically log out // If we're in production mode, we show a prompt instead as logging From 1f05932d79f0e383c278e718b03536929810d1b4 Mon Sep 17 00:00:00 2001 From: Sebin Song Date: Fri, 10 Jan 2025 03:44:19 +0900 Subject: [PATCH 2/4] #2498 - Fix the link bug in the chat (#2499) * fix the link rendering issue * updates for the change reuqest * revert unecessary prev-fix * remove another unecessary logic * add a comment --- .../chatroom/chat-mentions/chat-mentions-utils.js | 12 +++++++++--- frontend/views/utils/markdown-utils.js | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js b/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js index b623dc12c..7d47c68ff 100644 --- a/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js +++ b/frontend/views/containers/chatroom/chat-mentions/chat-mentions-utils.js @@ -61,6 +61,7 @@ function createRecursiveDomObjects (element: any): DomObject { const isNodeTypeText = element?.nodeType === Node.TEXT_NODE const isNodeCodeElement = element?.nodeName === 'CODE' // ... element needs a special treatment in the chat. + const isBodyElement = element?.nodeName === 'BODY' const nodeObj: DomObject = isNodeTypeText ? { tagName: null, attributes: {}, text: element.textContent } @@ -87,9 +88,14 @@ function createRecursiveDomObjects (element: any): DomObject { nodeObj.children.push(createRecursiveDomObjects(child)) } - nodeObj.children = nodeObj.children.filter( - child => child.tagName || (child.text || '').trim().length - ) + nodeObj.children = nodeObj.children.filter(child => { + if (child.tagName) return true + else { + return isBodyElement + ? child.text !== '\n' // DOMParser.parseFromString() adds a '\n' at the end of the body content which needs to be removed. + : (child.text || '').length + } + }) } return nodeObj diff --git a/frontend/views/utils/markdown-utils.js b/frontend/views/utils/markdown-utils.js index c4f92e1b2..0c25e3c46 100644 --- a/frontend/views/utils/markdown-utils.js +++ b/frontend/views/utils/markdown-utils.js @@ -59,7 +59,6 @@ export function renderMarkdown (str: string): any { // STEP 3. Remove the unecessary starting/end line-breaks added in/outside of the converted html tags. converted = converted.replace(/<([a-z]+)>\n/g, '<$1>') .replace(/\n<\/([a-z]+)>/g, '') - return converted } From 494c3f8f7faa702a7f9b33324934f91c86f36bc2 Mon Sep 17 00:00:00 2001 From: Pierre Schweiger Date: Sun, 12 Jan 2025 04:30:25 +0100 Subject: [PATCH 3/4] Prevent error on long press on the chatbox (#2484) --- frontend/views/containers/chatroom/MessageBase.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/views/containers/chatroom/MessageBase.vue b/frontend/views/containers/chatroom/MessageBase.vue index 8eebf4f3a..1bf4583bc 100644 --- a/frontend/views/containers/chatroom/MessageBase.vue +++ b/frontend/views/containers/chatroom/MessageBase.vue @@ -221,7 +221,9 @@ export default ({ this.$emit('add-emoticon', emoticon.native || emoticon) }, openMenu () { - this.$refs.messageAction.$refs.menu.handleTrigger() + if (this.$refs.messageAction?.$refs?.menu) { + this.$refs.messageAction.$refs.menu.handleTrigger() + } }, longPressHandler (e) { const wrappingLinkTag = e.target.closest('a.link[href]') @@ -230,7 +232,7 @@ export default ({ const url = wrappingLinkTag.getAttribute('href') sbp('okTurtles.events/emit', OPEN_TOUCH_LINK_HELPER, url) e?.preventDefault() - } else { + } else if (!this.isEditing) { this.openMenu() } } From 94fc55de3a2c60173f0353f5c445bb3e817e59f1 Mon Sep 17 00:00:00 2001 From: Sebin Song Date: Sun, 12 Jan 2025 12:53:17 +0900 Subject: [PATCH 4/4] #2490 - Implement image-attachment by pasting it (#2496) * implement image-attachment by pasting it * remove the file from another task --- frontend/views/containers/chatroom/SendArea.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/views/containers/chatroom/SendArea.vue b/frontend/views/containers/chatroom/SendArea.vue index e3f6700a6..e41cf978d 100644 --- a/frontend/views/containers/chatroom/SendArea.vue +++ b/frontend/views/containers/chatroom/SendArea.vue @@ -562,6 +562,11 @@ export default ({ } }, handlePaste (e) { + if (e.clipboardData.files.length > 0) { + this.fileAttachmentHandler(e.clipboardData.files, true) + return + } + // fix for the edge-case related to 'paste' action when nothing has been typed // (reference: https://github.com/okTurtles/group-income/issues/2369) const currVal = this.$refs.textarea.value