Merge pull request #20007 from prlanzarin/u27/fix/invalid-metadataprop-access

[2.7] fix(bbb-html5): crash due to undefined metadataProp access
This commit is contained in:
Anton Georgiev 2024-04-12 15:32:17 -04:00 committed by GitHub
commit 2f3e709324
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,11 +2,10 @@ import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings';
export default function getFromMeetingSettings(setting, defaultValue) {
const prop = Meetings.findOne(
const meeting = Meetings.findOne(
{ meetingId: Auth.meetingID },
{ fields: { 'metadataProp': 1 } },
).metadataProp;
const value = prop.metadata ? prop.metadata[setting] : undefined;
{ fields: { metadataProp: 1 } },
);
return value || defaultValue;
return meeting?.metadataProp?.metadata?.[setting] ?? defaultValue;
}