diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index 92c90aa..602eea8 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -25,24 +25,26 @@ class ContentViewerController < ApplicationController return end end - - # page not found, give error - if @page.nil? - render_not_found(@path) - return - end end - if !@page.display_to?(user) - if profile.display_info_to?(user) || !profile.visible? - message = _('You are not allowed to view this content. You can contact the owner of this profile to request access then.') + if !@page.nil? && !@page.display_to?(user) + if !profile.public? + private_profile_partial_parameters + render :template => 'profile/_private_profile.rhtml', :status => 403 + else #if !profile.visible? + message = _('You are not allowed to view this content.') + message += ' ' + _('You can contact the owner of this profile to request access then.') render_access_denied(message) - elsif !profile.public? - redirect_to :controller => 'profile', :action => 'index', :profile => profile.identifier end return end + # page not found, give error + if @page.nil? + render_not_found(@path) + return + end + if request.xhr? && params[:toolbar] render :partial => 'article_toolbar' return diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 2a7bd73..9096ef8 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -368,14 +368,7 @@ class ProfileController < PublicController end def private_profile - if profile.person? - @action = :add_friend - @message = _("The content here is available to %s's friends only.") % profile.short_name - else - @action = :join - @message = _('The contents in this community is available to members only.') - end - @no_design_blocks = true + private_profile_partial_parameters end def invisible_profile diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index af363d9..745dea1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1411,4 +1411,16 @@ module ApplicationHelper options[:class] = "comment-footer comment-footer-link comment-footer-hide" expirable_content_reference content, action, text, url, options end + + def private_profile_partial_parameters + if profile.person? + @action = :add_friend + @message = _("The content here is available to %s's friends only.") % profile.short_name + else + @action = :join + @message = _('The contents in this community is available to members only.') + end + @no_design_blocks = true + end + end -- libgit2 0.21.2