Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ExternalMessage): Fixing metadata validation when document or message #239

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(ExternalMessage): Fixing metadata validation when document or mes…
…sage

There are cases where it is necessary to check if a message has a document with a metadata for
external messages and if you already have the document in hand
  • Loading branch information
PlezBlip committed Jun 18, 2024
commit 9cf66069c571daf8c413651a7c8c2227533bd091
2 changes: 1 addition & 1 deletion src/components/BlipGroupCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
:position="group.position"
:date="group.date"
:failed-to-send-msg="failedMessageNotification(group.msgs[0].type)"
:is-external-message="checkIsExternalMessage(group.msgs[0].document)"
:is-external-message="checkIsExternalMessage(group.msgs[0])"
:external-message-text="externalMessageText"
:is-group="true"
:show-alert-icon="Boolean(onFailedClickIcon)"
Expand Down
19 changes: 14 additions & 5 deletions src/utils/externalMessages.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
function checkIsExternalMessage(document) {
function checkIsExternalMessage(msg) {
let innerDocument

if (msg && msg.document) {
innerDocument = msg.document
} else {
innerDocument = msg
}

const isExternalMessage = Boolean(
document &&
document.metadata &&
document.metadata['messageEmitter'] &&
document.metadata['messageEmitter'] === 'externalMessages'
innerDocument &&
innerDocument.metadata &&
innerDocument.metadata['messageEmitter'] &&
innerDocument.metadata['messageEmitter'] === 'externalMessages'
)

return isExternalMessage
}

Expand Down
Loading