diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index d8592233302d5f86069fbec8a482c40e03617539..f17056f13e0d80332557d87e23bc605bdd7d154f 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -21,7 +21,7 @@ def create_deploy_token def render_show @deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user) - @deploy_tokens = DeployTokensPresenter.new(@project.deploy_tokens.active, current_user: current_user, project: project) + @deploy_tokens = @project.deploy_tokens.active define_deploy_token define_protected_refs diff --git a/app/presenters/projects/settings/deploy_tokens_presenter.rb b/app/presenters/projects/settings/deploy_tokens_presenter.rb deleted file mode 100644 index ee82e516bfcc82625f88ffeaa92e07c65934a2f3..0000000000000000000000000000000000000000 --- a/app/presenters/projects/settings/deploy_tokens_presenter.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Projects - module Settings - class DeployTokensPresenter < Gitlab::View::Presenter::Simple - include Enumerable - - presents :deploy_tokens - - def length - deploy_tokens.length - end - - def each - deploy_tokens.each do |deploy_token| - yield deploy_token - end - end - end - end -end diff --git a/app/services/deploy_tokens/create_service.rb b/app/services/deploy_tokens/create_service.rb index e623d94b444c8764a9aa6cab9c41d4de74952d26..b5989e0bbf18f61a1e72acc09473eb5026bdb8ec 100644 --- a/app/services/deploy_tokens/create_service.rb +++ b/app/services/deploy_tokens/create_service.rb @@ -12,7 +12,7 @@ def deploy_token_params end def expires_at_date - params[:expires_at].present? ? default_expires_at : params[:expires_at] + params[:expires_at].presence || default_expires_at end def default_expires_at diff --git a/spec/presenters/projects/settings/deploy_tokens_presenter_spec.rb b/spec/presenters/projects/settings/deploy_tokens_presenter_spec.rb deleted file mode 100644 index a416acffe9408b2231d2fc521e0c77f4069c7920..0000000000000000000000000000000000000000 --- a/spec/presenters/projects/settings/deploy_tokens_presenter_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'spec_helper' - -describe Projects::Settings::DeployTokensPresenter do - let(:user) { create(:user) } - let(:project) { create(:project) } - let!(:project_deploy_tokens) { create_list(:project_deploy_token, 3, project: project) } - let(:deploy_tokens) { project.deploy_tokens } - - subject(:presenter) { described_class.new(deploy_tokens, current_user: user, project: project) } - - describe '#length' do - it 'returns the size of deploy tokens presented' do - expect(presenter.length).to eq(3) - end - end -end