71f958ca47
A client crash may happen if either the Meeting collection or the document's metadataProp attribute are undefined whenever the getFromMeetingSettings util is called to fetch metadata. It's debatable whether anything is working in the client if the documents being accessed here are unavailable, but it'll still be logged and might bork an ongoing reconnect. Use optional chaining + nullish coalescing to avoid causing TypeErrors in those situations while also returning default metadata values properly.
12 lines
350 B
JavaScript
12 lines
350 B
JavaScript
import Auth from '/imports/ui/services/auth';
|
|
import Meetings from '/imports/api/meetings';
|
|
|
|
export default function getFromMeetingSettings(setting, defaultValue) {
|
|
const meeting = Meetings.findOne(
|
|
{ meetingId: Auth.meetingID },
|
|
{ fields: { metadataProp: 1 } },
|
|
);
|
|
|
|
return meeting?.metadataProp?.metadata?.[setting] ?? defaultValue;
|
|
}
|