0001-Make-User-profile-404-rendering-more-consistent-and-.patch

Jan from Planio www.plan.io, 2014-10-18 15:56

Download (1.51 KB)

View differences:

app/controllers/users_controller.rb
62 62
    # show projects based on current user visibility
63 63
    @memberships = @user.memberships.where(Project.visible_condition(User.current)).all
64 64

  
65
    events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
66
    @events_by_day = events.group_by(&:event_date)
67

  
68
    unless User.current.admin?
69
      if !@user.active? || (@user != User.current  && @memberships.empty? && events.empty?)
70
        render_404
71
        return
72
      end
65
    if !@user.active? && !User.current.admin?
66
      render_404
67
      return
73 68
    end
74 69

  
75 70
    respond_to do |format|
76
      format.html { render :layout => 'base' }
71
      format.html do
72
        events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
73
        @events_by_day = events.group_by(&:event_date)
74
        render :layout => 'base'
75
      end
77 76
      format.api
78 77
    end
79 78
  end
80
-