[object Object]

← back to NationalPaperHangers

post-deploy: deploy scripts v2/v3, LinkedIn auth route, 6 templates live in prod

07b632e69d99151b047dddc75e50966f85ae8e03 · 2026-05-06 10:25:13 -0700 · Steve

Files touched

Diff

commit 07b632e69d99151b047dddc75e50966f85ae8e03
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed May 6 10:25:13 2026 -0700

    post-deploy: deploy scripts v2/v3, LinkedIn auth route, 6 templates live in prod
---
 lib/auth.js               | 6 +++++-
 routes/public.js          | 9 +++++++--
 views/partials/header.ejs | 6 +++++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lib/auth.js b/lib/auth.js
index 5cdf7ee..b3c3cd9 100644
--- a/lib/auth.js
+++ b/lib/auth.js
@@ -55,7 +55,11 @@ async function attachInstaller(req, res, next) {
       console.error('[attachInstaller]', err.message);
     }
   }
-  res.locals.installer = req.installer || null;
+  // Use a distinct local name so it doesn't collide with route-passed
+  // `installer` (which is the profile-being-VIEWED on /installer/:slug,
+  // not the logged-in user). Header partials read `currentInstaller`.
+  res.locals.currentInstaller = req.installer || null;
+  res.locals.installer = req.installer || null; // back-compat for admin views
   next();
 }
 
diff --git a/routes/public.js b/routes/public.js
index cf24feb..efee0a9 100644
--- a/routes/public.js
+++ b/routes/public.js
@@ -189,10 +189,15 @@ router.get('/installer/:slug', async (req, res, next) => {
 
 router.get('/installer/:slug/book', async (req, res, next) => {
   try {
+    // Show the page for both active AND unclaimed studios. Unclaimed
+    // studios fall through to the calendarEnabled=false branch which
+    // surfaces the contact-direct path (website / IG / phone).
+    // Bug fix 2026-05-06: previously 404'd for unclaimed, which created
+    // a dead-end click from /installer/:slug pages.
     const installer = await db.one(
       `SELECT id, slug, business_name, city, state, response_time_hours, tier,
-              website, instagram_handle, phone
-         FROM installers WHERE slug = $1 AND status = 'active'`,
+              website, instagram_handle, phone, claim_status, status
+         FROM installers WHERE slug = $1 AND (status = 'active' OR claim_status = 'unclaimed')`,
       [req.params.slug]
     );
     if (!installer) return res.status(404).render('public/404', { title: 'Not Found' });
diff --git a/views/partials/header.ejs b/views/partials/header.ejs
index dc707a5..5ee7720 100644
--- a/views/partials/header.ejs
+++ b/views/partials/header.ejs
@@ -16,7 +16,11 @@
         <span class="t-light" aria-hidden="true">☼</span>
         <span class="t-dark" aria-hidden="true">☾</span>
       </button>
-      <% if (locals.installer) { %>
+      <% /* Bug fix 2026-05-06: was reading `locals.installer`, but on
+            /installer/:slug routes that variable is the profile being
+            VIEWED, not the logged-in user. attachInstaller now sets
+            `currentInstaller` for unambiguous identity. */ %>
+      <% if (locals.currentInstaller) { %>
         <a href="/admin" class="btn btn-ghost">Dashboard</a>
       <% } else { %>
         <a href="/login" class="btn btn-ghost">Installer login</a>

← 4606c77 post-launch v0.2 design fixes — sticky reserve banner, drop  ·  back to NationalPaperHangers  ·  post-launch QA fixes — header Dashboard label bug, /book gat 324d2ba →