From c51b772fae764df0798f6bf5be3b501e884c9ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 8 Jun 2024 12:30:26 -0400 Subject: [PATCH] feat: add isACP to config, closes #12623 --- public/openapi/read/config.yaml | 3 +++ src/controllers/api.js | 1 + 2 files changed, 4 insertions(+) diff --git a/public/openapi/read/config.yaml b/public/openapi/read/config.yaml index ceb99c0d58..69520e29a3 100644 --- a/public/openapi/read/config.yaml +++ b/public/openapi/read/config.yaml @@ -94,6 +94,9 @@ get: uid: type: number description: A user identifier + isACP: + type: boolean + description: true if admin page is being loaded, false otherwise cache-buster: type: string topicPostSort: diff --git a/src/controllers/api.js b/src/controllers/api.js index 22574a9ce6..7c575b6070 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -67,6 +67,7 @@ apiController.loadConfig = async function (req) { userLang: req.query.lang ? validator.escape(String(req.query.lang)) : (meta.config.defaultLang || 'en-GB'), loggedIn: !!req.user, uid: req.uid, + isACP: !!(req.res && req.res.locals && req.res.locals.renderAdminHeader), 'cache-buster': meta.config['cache-buster'] || '', topicPostSort: meta.config.topicPostSort || 'oldest_to_newest', categoryTopicSort: meta.config.categoryTopicSort || 'recently_replied',