-
-
Save dvander/9406554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb | |
index b927dd2..c179a14 100644 | |
--- a/app/controllers/groups_controller.rb | |
+++ b/app/controllers/groups_controller.rb | |
@@ -6,6 +6,7 @@ class GroupsController < ApplicationController | |
before_filter :authorize_read_group!, except: [:new, :create] | |
before_filter :authorize_admin_group!, only: [:edit, :update, :destroy] | |
before_filter :authorize_create_group!, only: [:new, :create] | |
+ skip_before_filter :authenticate_user!, :set_current_user_for_observers, only: [:show] | |
# Load group projects | |
before_filter :projects, except: [:new, :create] | |
@@ -36,7 +37,9 @@ class GroupsController < ApplicationController | |
@events = Event.in_projects(project_ids) | |
@events = event_filter.apply_filter(@events) | |
@events = @events.limit(20).offset(params[:offset] || 0) | |
- @last_push = current_user.recent_push | |
+ if current_user | |
+ @last_push = current_user.recent_push | |
+ end | |
respond_to do |format| | |
format.html | |
@@ -98,7 +101,11 @@ class GroupsController < ApplicationController | |
end | |
def projects | |
- @projects ||= current_user.authorized_projects.where(namespace_id: group.id).sorted_by_activity | |
+ if current_user | |
+ @projects ||= current_user.authorized_projects.where(namespace_id: group.id).sorted_by_activity | |
+ else | |
+ @projects ||= Project.public_or_internal_only(current_user).where(namespace_id: group.id).sorted_by_activity | |
+ end | |
end | |
def project_ids | |
@@ -131,6 +138,8 @@ class GroupsController < ApplicationController | |
def determine_layout | |
if [:new, :create].include?(action_name.to_sym) | |
'navless' | |
+ elsif action_name.to_sym == :show && !user_signed_in? | |
+ 'public' | |
else | |
'group' | |
end | |
diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml | |
index 029d6cb..e1466cd 100644 | |
--- a/app/views/groups/_projects.html.haml | |
+++ b/app/views/groups/_projects.html.haml | |
@@ -16,6 +16,6 @@ | |
= visibility_level_icon(project.visibility_level) | |
%span.str-truncated | |
%span.project-name | |
- = truncate(project.name, length: 25) | |
+ %strong= truncate(project.name, length: 25) | |
%span.arrow | |
%i.icon-angle-right | |
diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml | |
index 6256c04..e3aa6e3 100644 | |
--- a/app/views/groups/show.html.haml | |
+++ b/app/views/groups/show.html.haml | |
@@ -1,10 +1,6 @@ | |
.dashboard | |
.activities.col-md-8.hidden-sm | |
= render "events/event_last_push", event: @last_push | |
- = link_to dashboard_path, class: 'btn btn-tiny' do | |
- ← To dashboard | |
- | |
- %span.cgray You will only see events from projects in this group | |
%hr | |
= render 'shared/event_filter' | |
- if @events.any? | |
@@ -21,11 +17,12 @@ | |
- if @group.description.present? | |
%p= @group.description | |
= render "projects", projects: @projects | |
- .prepend-top-20 | |
- = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed" do | |
- %strong | |
- %i.icon-rss | |
- News Feed | |
+ - if current_user | |
+ .prepend-top-20 | |
+ = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed" do | |
+ %strong | |
+ %i.icon-rss | |
+ News Feed | |
%hr | |
= render 'shared/promo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment