Skip to content

Commit

Permalink
fixed profile link issues with # when user discoverability is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Dec 3, 2024
1 parent 633502d commit afdb872
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public String get(@PathVariable(required = false) String id, HttpServletRequest
boolean protekted = !utils.isDefaultSpacePublic() && !utils.isAuthenticated(req);
boolean sameSpace = (utils.canAccessSpace(showUser, "default") && utils.canAccessSpace(authUser, "default")) ||
(authUser != null && showUser.getSpaces().stream().anyMatch(s -> utils.canAccessSpace(authUser, s)));
if (protekted || !sameSpace || !CONF.usersDiscoverabilityEnabled(utils.isAdmin(authUser))) {
boolean profilesAreHidden = !isMyProfile && !CONF.usersDiscoverabilityEnabled(utils.isAdmin(authUser));
if (protekted || !sameSpace || profilesAreHidden) {
return "redirect:" + PEOPLELINK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void postHandle(HttpServletRequest request, HttpServletResponse response,
modelAndView.addObject("scriptslink", CONF.scriptsLink()); // do not add context path prefix!
modelAndView.addObject("styleslink", CONF.stylesLink()); // do not add context path prefix!
modelAndView.addObject("peoplelink", CONF.serverContextPath() + PEOPLELINK);
modelAndView.addObject("profilelink", CONF.usersDiscoverabilityEnabled(utils.isAdmin(authUser)) ? CONF.serverContextPath() + PROFILELINK : "#");
modelAndView.addObject("profilelink", CONF.serverContextPath() + PROFILELINK);
modelAndView.addObject("searchlink", CONF.serverContextPath() + SEARCHLINK);
modelAndView.addObject("signinlink", CONF.serverContextPath() + SIGNINLINK);
modelAndView.addObject("signoutlink", CONF.serverContextPath() + SIGNOUTLINK);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/base.vm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

#macro(navbarlinks)
<li><a href="$questionslink" title="$!lang.get('questions.title')" class="$!{questionsSelected}">$!lang.get("questions.title")</a></li>
#if($profilelink != "#")
#if($scooldUtils.config.usersDiscoverabilityEnabled($isAdmin))
<li><a href="$peoplelink" title="$!lang.get('people.title')" class="$!{peopleSelected}">$!lang.get("people.title")</a></li>
#end
<li><a href="$tagslink" title="$!lang.get('tags.title')" class="$!{tagsSelected}">$!lang.get("tags.title")</a></li>
Expand Down Expand Up @@ -273,7 +273,7 @@
#end
<li><a href="$questionslink/ask" title="$!lang.get('posts.ask')" class="$!{askSelected}">$!lang.get("posts.ask")</a></li>
<li><a href="$questionslink" title="$!lang.get('questions.title')" class="$!{questionsSelected}">$!lang.get("questions.title")</a></li>
#if($profilelink != "#")
#if($scooldUtils.config.usersDiscoverabilityEnabled($isAdmin))
<li><a href="$peoplelink" title="$!lang.get('people.title')" class="$!{peopleSelected}">$!lang.get("people.title")</a></li>
#end
<li><a href="$tagslink" title="$!lang.get('tags.title')" class="$!{tagsSelected}">$!lang.get("tags.title")</a></li>
Expand Down

0 comments on commit afdb872

Please sign in to comment.