From b128807026e55c996caf2d250b2ee4599532a4e4 Mon Sep 17 00:00:00 2001 From: Brandon Castillo Date: Tue, 29 Aug 2023 10:31:32 -0700 Subject: [PATCH 1/2] [MARKENG-2777] Added login check to view profile link when signed in --- manifest.json | 2 +- script.js | 25 +++++++++++++++++++++++++ templates/header.hbs | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index f05016f..da6b737 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "post-zen", "author": "Brandon Castillo, Marketing Engineering, Postman.", - "version": "1.8.0", + "version": "1.9.0", "api_version": 2, "default_locale": "en-us", "settings": [ diff --git a/script.js b/script.js index 10a482f..17957c9 100644 --- a/script.js +++ b/script.js @@ -696,6 +696,31 @@ if (window.location.href.includes("support.postman.com/hc/en-us")) { }); } +function getCookie(cname) { + let name = cname + "="; + let decodedCookie = decodeURIComponent(document.cookie); + let ca = decodedCookie.split(';'); + for(let i = 0; i { + let profile = document.getElementById("pm-signed-in"); + const isSignedIn = getCookie("ajs_user_id"); + isSignedIn ? profile.setAttribute("href", `/hc/en-us/profiles/${isSignedIn}`) : profile.setAttribute("href", `/hc/en-us/profiles/shared`) + }, 500) + +}()) + jQuery(document).ready(function () { /* pmtSDK diff --git a/templates/header.hbs b/templates/header.hbs index 438e27c..fd8dc1c 100644 --- a/templates/header.hbs +++ b/templates/header.hbs @@ -250,7 +250,7 @@ {{/unless}} {{#if signed_in}}