diff options
author | Camil Staps <info@camilstaps.nl> | 2019-01-27 13:18:09 +0300 |
---|---|---|
committer | Camil Staps <info@camilstaps.nl> | 2019-08-07 21:49:14 +0300 |
commit | 382826855c77986823691d74e1e6b47ad715d652 (patch) | |
tree | 7f44c9cbc542668aa7aff5a2dfedc79bf5818640 /app/controllers | |
parent | 936d4e80e4abc2efcc5d88865d5d420c42a84370 (diff) |
Add "Starred projects" tab to user overview
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/users_controller.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 072d62ddf38..36687e3606e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -17,7 +17,7 @@ class UsersController < ApplicationController prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:rss) } before_action :user, except: [:exists] before_action :authorize_read_user_profile!, - only: [:calendar, :calendar_activities, :groups, :projects, :contributed_projects, :snippets] + only: [:calendar, :calendar_activities, :groups, :projects, :contributed_projects, :starred_projects, :snippets] def show respond_to do |format| @@ -82,6 +82,19 @@ class UsersController < ApplicationController end end + def starred + load_starred_projects + + respond_to do |format| + format.html { render 'show' } + format.json do + render json: { + html: view_to_html_string("shared/projects/_list", projects: @starred_projects) + } + end + end + end + def snippets load_snippets @@ -120,6 +133,10 @@ class UsersController < ApplicationController ContributedProjectsFinder.new(user).execute(current_user) end + def starred_projects + StarredProjectsFinder.new(user).execute(current_user) + end + def contributions_calendar @contributions_calendar ||= Gitlab::ContributionsCalendar.new(user, current_user) end @@ -145,6 +162,12 @@ class UsersController < ApplicationController prepare_projects_for_rendering(@contributed_projects) end + def load_starred_projects + @starred_projects = starred_projects.joined(user) + + prepare_projects_for_rendering(@starred_projects) + end + def load_groups @groups = JoinedGroupsFinder.new(user).execute(current_user) |