X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Fmanager.js;fp=src%2Fmanager.js;h=d33d345d280fc3a4bf2b422faf9e66abd4f39e23;hb=f7e70910f579079d04c4cbeff750c8721a51fbe6;hp=74730c27be142a5ac33e467fccec182d61bcefde;hpb=02d9e6e66b116454a944b47e5dbed31a7d6c061d;p=websub-hub diff --git a/src/manager.js b/src/manager.js index 74730c2..d33d345 100644 --- a/src/manager.js +++ b/src/manager.js @@ -354,7 +354,7 @@ class Manager { // Parse and validate all the topics in the request. data.publishTopics = await this._publishTopics(dbCtx, data, requestId); - if (!data.publishTopics || !data.publishTopics.length) { + if (!data?.publishTopics?.length) { const details = Manager._prettyDetails(['no valid topic urls to publish'], []); throw new ResponseError(Enum.ErrorResponse.BadRequest, details); } @@ -636,7 +636,7 @@ class Manager { this.logger.debug(_scope, 'got topics', { topics: ctx.topics }); // Profile users can only see related topics. - if (ctx.session && ctx.session.authenticatedProfile) { + if (ctx?.session?.authenticatedProfile) { const profileUrlObj = new URL(ctx.session.authenticatedProfile); ctx.topics = ctx.topics.filter((topic) => { const topicUrlObj = new URL(topic.url); @@ -673,7 +673,7 @@ class Manager { this.logger.debug(_scope, 'got topic details', { topic: ctx.topic, subscriptions: ctx.subscriptions, updates: ctx.publishCount }); // Profile users can only see related topics. - if (ctx.session && ctx.session.authenticatedProfile) { + if (ctx?.session?.authenticatedProfile) { const profileUrlObj = new URL(ctx.session.authenticatedProfile); const topicUrlObj = new URL(ctx.topic.url); if (!Manager._profileControlsTopic(profileUrlObj, topicUrlObj)) { @@ -683,7 +683,7 @@ class Manager { } res.end(Template.adminTopicDetailsHTML(ctx, this.options)); - this.logger.info(_scope, 'finished', { ctx, subscriptions: ctx.subscriptions.length, topic: ctx.topic && ctx.topic.id || ctx.topic }); + this.logger.info(_scope, 'finished', { ctx, subscriptions: ctx.subscriptions.length, topic: ctx?.topic?.id || ctx.topic }); }