Regression: Add optional chaining to possibly undefined fields (#24033)

pull/24035/head
Kevin Aleman 4 years ago committed by GitHub
parent ce27f1aea0
commit 3a5eaacfa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/ui/client/lib/chatMessages.js
  2. 2
      app/ui/client/views/app/room.js

@ -594,7 +594,8 @@ export class ChatMessages {
onDestroyed(rid, tmid) {
UserAction.cancel(rid);
if (this.input.parentElement?.classList.contains('editing') === true) {
// TODO: check why we need too many ?. here :(
if (this.input?.parentElement?.classList.contains('editing') === true) {
if (!tmid) {
this.clearCurrentDraft();
this.clearEditing();

@ -180,7 +180,7 @@ Template.roomOld.helpers({
const { rid } = Template.instance();
const room = Rooms.findOne(rid, { fields: { sysMes: 1 } });
const hideSettings = settings.collection.findOne('Hide_System_Messages') || {};
const settingValues = Array.isArray(room.sysMes) ? room.sysMes : hideSettings.value || [];
const settingValues = Array.isArray(room?.sysMes) ? room.sysMes : hideSettings.value || [];
const hideMessagesOfType = new Set(settingValues.reduce((array, value) => [...array, ...value === 'mute_unmute' ? ['user-muted', 'user-unmuted'] : [value]], []));
const query = {
rid,

Loading…
Cancel
Save