BigW Consortium Gitlab

dashboard_controller.rb 831 Bytes
Newer Older
1
class DashboardController < Dashboard::ApplicationController
2 3 4
  include IssuesAction
  include MergeRequestsAction

5
  before_action :event_filter, only: :activity
6
  before_action :projects, only: [:issues, :merge_requests]
7

8
  respond_to :html
9

10 11 12 13 14 15 16 17 18 19 20 21 22
  def activity
    @last_push = current_user.recent_push

    respond_to do |format|
      format.html

      format.json do
        load_events
        pager_json("events/_events", @events.count)
      end
    end
  end

23 24
  protected

25
  def load_events
26
    projects =
27 28 29 30
      if params[:filter] == "starred"
        current_user.starred_projects
      else
        current_user.authorized_projects
31
      end
32

33
    @events = Event.in_projects(projects)
34 35 36
    @events = @event_filter.apply_filter(@events).with_associations
    @events = @events.limit(20).offset(params[:offset] || 0)
  end
gitlabhq committed
37
end