private String publicProfile(Model model, User profiled, User user) {
    if (profiled.equals(user)) return profile(model);

    model.addAttribute("profiled", profiled);
    model.addAttribute("user", user);
    model.addAttribute("isFriend", areFriends(profiled, user));
    return "/user/public";
  }
 private boolean areFriends(User user, User loggedIn) {
   return user != null && user.isFriend(loggedIn);
 }