Skip to content

Commit

Permalink
Merge branch 'master' into 1927-design-implement-contract-deletion-op…
Browse files Browse the repository at this point in the history
…_contract_delete
  • Loading branch information
corrideat committed Jan 12, 2025
2 parents 1b6fda5 + 94fc55d commit 45252ef
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
10 changes: 10 additions & 0 deletions frontend/controller/app/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions frontend/views/containers/chatroom/MessageBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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]')
Expand All @@ -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()
}
}
Expand Down
5 changes: 5 additions & 0 deletions frontend/views/containers/chatroom/SendArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function createRecursiveDomObjects (element: any): DomObject {

const isNodeTypeText = element?.nodeType === Node.TEXT_NODE
const isNodeCodeElement = element?.nodeName === 'CODE' // <code> ... </code> element needs a special treatment in the chat.
const isBodyElement = element?.nodeName === 'BODY'

const nodeObj: DomObject = isNodeTypeText
? { tagName: null, attributes: {}, text: element.textContent }
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion frontend/views/utils/markdown-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '</$1>')

return converted
}

Expand Down

0 comments on commit 45252ef

Please sign in to comment.