From 380e40fee30d836e6dffb1e956df39033d43a671 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Wed, 12 Apr 2017 16:13:24 +0100 Subject: Remove unused user activities code --- lib/api/helpers/internal_helpers.rb | 3 +- lib/api/internal.rb | 10 ------ lib/api/users.rb | 1 - lib/gitlab/pagination_delegate.rb | 65 ------------------------------------- 4 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 lib/gitlab/pagination_delegate.rb (limited to 'lib') diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index 8f25bcf2f54..718f936a1fc 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -62,8 +62,7 @@ module API end def log_user_activity(actor) - commands = Gitlab::GitAccess::DOWNLOAD_COMMANDS + - Gitlab::GitAccess::GIT_ANNEX_COMMANDS + commands = Gitlab::GitAccess::DOWNLOAD_COMMANDS ::Users::ActivityService.new(actor, 'Git SSH').execute if commands.include?(params[:action]) end diff --git a/lib/api/internal.rb b/lib/api/internal.rb index d374d183dcd..5b48ee8665f 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -15,16 +15,6 @@ module API # project - project path with namespace # action - git action (git-upload-pack or git-receive-pack) # changes - changes as "oldrev newrev ref", see Gitlab::ChangesList - helpers do - def log_user_activity(actor) - commands = Gitlab::GitAccess::DOWNLOAD_COMMANDS + - Gitlab::GitAccess::PUSH_COMMANDS + - Gitlab::GitAccess::GIT_ANNEX_COMMANDS - - ::Users::ActivityService.new(actor, 'Git SSH').execute if commands.include?(params[:action]) - end - end - post "/allowed" do status 200 diff --git a/lib/api/users.rb b/lib/api/users.rb index bcfbd9ab3c5..9e0faff6c05 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -535,7 +535,6 @@ module API current_user.update_secondary_emails! end - desc 'Get a list of user activities' params do optional :from, type: DateTime, default: 6.months.ago, desc: 'Date string in the format YEAR-MONTH-DAY' diff --git a/lib/gitlab/pagination_delegate.rb b/lib/gitlab/pagination_delegate.rb deleted file mode 100644 index d4913e908b2..00000000000 --- a/lib/gitlab/pagination_delegate.rb +++ /dev/null @@ -1,65 +0,0 @@ -module Gitlab - class PaginationDelegate - DEFAULT_PER_PAGE = Kaminari.config.default_per_page - MAX_PER_PAGE = Kaminari.config.max_per_page - - def initialize(page:, per_page:, count:, options: {}) - @count = count - @options = { default_per_page: DEFAULT_PER_PAGE, - max_per_page: MAX_PER_PAGE }.merge(options) - - @per_page = sanitize_per_page(per_page) - @page = sanitize_page(page) - end - - def total_count - @count - end - - def total_pages - (total_count.to_f / @per_page).ceil - end - - def next_page - current_page + 1 unless last_page? - end - - def prev_page - current_page - 1 unless first_page? - end - - def current_page - @page - end - - def limit_value - @per_page - end - - def first_page? - current_page == 1 - end - - def last_page? - current_page >= total_pages - end - - def offset - (current_page - 1) * limit_value - end - - private - - def sanitize_per_page(per_page) - return @options[:default_per_page] unless per_page && per_page > 0 - - [@options[:max_per_page], per_page].min - end - - def sanitize_page(page) - return 1 unless page && page > 1 - - [total_pages, page].min - end - end -end -- cgit v1.2.1