fix: TypeError cannot read properties of null (reading 'file_type') (#9778)
# Pull Request Template ## Description **Cases** ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
@@ -127,7 +127,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="shouldShowContextMenu"
|
v-if="shouldShowContextMenu"
|
||||||
class="context-menu-wrap invisible group-hover:visible"
|
class="invisible context-menu-wrap group-hover:visible"
|
||||||
>
|
>
|
||||||
<context-menu
|
<context-menu
|
||||||
v-if="isBubble && !isMessageDeleted"
|
v-if="isBubble && !isMessageDeleted"
|
||||||
@@ -166,6 +166,7 @@ import { ACCOUNT_EVENTS } from 'dashboard/helper/AnalyticsHelper/events';
|
|||||||
import { LOCAL_STORAGE_KEYS } from 'dashboard/constants/localStorage';
|
import { LOCAL_STORAGE_KEYS } from 'dashboard/constants/localStorage';
|
||||||
import { LocalStorage } from 'shared/helpers/localStorage';
|
import { LocalStorage } from 'shared/helpers/localStorage';
|
||||||
import { getDayDifferenceFromNow } from 'shared/helpers/DateHelper';
|
import { getDayDifferenceFromNow } from 'shared/helpers/DateHelper';
|
||||||
|
import * as Sentry from '@sentry/browser';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -502,15 +503,29 @@ export default {
|
|||||||
},
|
},
|
||||||
hasMediaAttachment(type) {
|
hasMediaAttachment(type) {
|
||||||
if (this.hasAttachments && this.data.attachments.length > 0) {
|
if (this.hasAttachments && this.data.attachments.length > 0) {
|
||||||
const { attachments = [{}] } = this.data;
|
return this.compareMessageFileType(this.data, type);
|
||||||
const { file_type: fileType } = attachments[0];
|
|
||||||
return fileType === type && !this.hasMediaLoadError;
|
|
||||||
}
|
}
|
||||||
if (this.storyReply) {
|
if (this.storyReply) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
compareMessageFileType(messageData, type) {
|
||||||
|
try {
|
||||||
|
const { attachments = [{}] } = messageData;
|
||||||
|
const { file_type: fileType } = attachments[0];
|
||||||
|
return fileType === type && !this.hasMediaLoadError;
|
||||||
|
} catch (err) {
|
||||||
|
Sentry.setContext('attachment-parsing-error', {
|
||||||
|
messageData,
|
||||||
|
type,
|
||||||
|
hasMediaLoadError: this.hasMediaLoadError,
|
||||||
|
});
|
||||||
|
|
||||||
|
Sentry.captureException(err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
handleContextMenuClick() {
|
handleContextMenuClick() {
|
||||||
this.showContextMenu = !this.showContextMenu;
|
this.showContextMenu = !this.showContextMenu;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user