Explorar o código

Merge pull request #10772 from overleaf/em-ieee-brand-id

Make the IEEE brand id configurable

GitOrigin-RevId: 3ee286131d6ed8f43247ab1e2954eabec83d75d6
Eric Mc Sween %!s(int64=3) %!d(string=hai) anos
pai
achega
04d0eabb32

+ 3 - 3
services/web/app/src/infrastructure/ExpressLocals.js

@@ -21,6 +21,8 @@ const {
   addOptionalCleanupHandlerAfterDrainingConnections,
 } = require('./GracefulShutdown')
 
+const IEEE_BRAND_ID = Settings.ieeeBrandId
+
 let webpackManifest
 switch (process.env.NODE_ENV) {
   case 'production':
@@ -179,10 +181,8 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
 
     res.locals.moment = moment
 
-    const IEEE_BRAND_ID = 15
     res.locals.isIEEE = brandVariation =>
-      (brandVariation != null ? brandVariation.brand_id : undefined) ===
-      IEEE_BRAND_ID
+      brandVariation?.brand_id === IEEE_BRAND_ID
 
     res.locals.getCssThemeModifier = function (userSettings, brandVariation) {
       // Themes only exist in OL v2

+ 3 - 0
services/web/config/settings.defaults.js

@@ -801,6 +801,9 @@ module.exports = {
   unsupportedBrowsers: {
     ie: '<=11',
   },
+
+  // ID of the IEEE brand in the rails app
+  ieeeBrandId: intFromEnv('IEEE_BRAND_ID', 15),
 }
 
 module.exports.mergeWith = function (overrides) {