fix(hub): activity card links to /u/{handle}/ when same origin to avoid hub loop
This commit is contained in:
@@ -113,8 +113,14 @@ const singleHandle = isSingleUser ? shards[0].handle : null;
|
||||
appsDiv.style.display = '';
|
||||
greeting.textContent = `Ciao, ${user.display_name || user.handle}.`;
|
||||
cardsDiv.innerHTML = '';
|
||||
if (user.activity_access && activityUrl)
|
||||
cardsDiv.appendChild(appCard('BincioActivity', 'Tracks, strade e numeri', activityUrl));
|
||||
if (user.activity_access && activityUrl) {
|
||||
// If activityUrl is the same origin (dev --hub mode), go to the user page
|
||||
// directly so we don't loop back to the hub root.
|
||||
const activityHref = activityUrl === window.location.origin
|
||||
? `${activityUrl}/u/${user.handle}/`
|
||||
: activityUrl;
|
||||
cardsDiv.appendChild(appCard('BincioActivity', 'Tracks, strade e numeri', activityHref));
|
||||
}
|
||||
if (user.wiki_access && wikiUrl)
|
||||
cardsDiv.appendChild(appCard('BincioWiki', 'La memoria collettiva del gruppo', wikiUrl));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user