@bcc-code/vue-bcc-chat-ui 3.18.0 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@bcc-code/vue-bcc-chat-ui",
3
3
  "author": "bcc-code",
4
4
  "license": "Apache-2.0",
5
- "version": "3.18.0",
5
+ "version": "3.19.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -6,6 +6,7 @@ import { inject, ref } from 'vue';
6
6
  import { CometChatTheme, fontHelper } from '@cometchat/uikit-resources';
7
7
  import BccReplyPreview from "./BccReplyPreview.vue";
8
8
  import BccImageBubble from './BccImageBubble.vue';
9
+ import { offlineStore } from '../offline';
9
10
 
10
11
  const props = defineProps({
11
12
  text: {
@@ -15,6 +16,10 @@ const props = defineProps({
15
16
  metadata: {
16
17
  type: Object
17
18
  },
19
+ guid: {
20
+ type: String,
21
+ default: ""
22
+ },
18
23
  mentionedUsers: {
19
24
  type: Array<User>
20
25
  },
@@ -79,7 +84,29 @@ function formatMentionsInText(text: string) {
79
84
 
80
85
  let parentMsgRef = ref<BaseMessage>();
81
86
  if (props.metadata?.replyToMessageId) {
82
- CometChat.getMessageDetails(props.metadata.replyToMessageId).then((msg: BaseMessage) => parentMsgRef.value = msg).catch(() => parentMsgRef.value = new CometChat.TextMessage("","Unknown message",""));
87
+ let guidString = props.guid?.toString()
88
+ let group = offlineStore.getGroup(guidString)
89
+
90
+ //for read only replies
91
+ if (group != null && group?.hasJoined == undefined) {
92
+ let message = offlineStore.getMessage(props.metadata.replyToMessageId).data
93
+
94
+ if (message !== undefined) {
95
+ if (message.type == CometChat.MESSAGE_TYPE.TEXT) {
96
+ let text = new CometChat.TextMessage(message.receiver, message.data.text, message.receiverType)
97
+ text.setData(message.data)
98
+ parentMsgRef.value = text
99
+ } else {
100
+ let media = new CometChat.MediaMessage(message.receiver, {}, message.type, message.receiverType)
101
+ media.setData(message.data)
102
+ parentMsgRef.value = media
103
+ }
104
+ } else {
105
+ parentMsgRef.value = new CometChat.TextMessage("","Cannot load message","")
106
+ }
107
+ } else {
108
+ CometChat.getMessageDetails(props.metadata.replyToMessageId).then((msg: BaseMessage) => parentMsgRef.value = msg).catch(() => parentMsgRef.value = new CometChat.TextMessage("","Unknown message",""));
109
+ }
83
110
  };
84
111
 
85
112
  const { theme } = inject("theme", { theme: ref(new CometChatTheme({})) });
@@ -140,6 +140,10 @@ function isChannel(): boolean {
140
140
  }
141
141
 
142
142
  function isParticipant(): boolean {
143
+ //if not part of the group return true anyway since getScope dosen't exist when not in the group
144
+ if (!chatGroup.value?.getHasJoined()) {
145
+ return true
146
+ }
143
147
  return chatGroup.value?.getScope() == "participant";
144
148
  }
145
149