diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index a87927fe1ec..fb175b4a636 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -13,7 +13,7 @@ module Projects def define_protected_refs @protected_branches = @project.protected_branches.order(:name).page(params[:page]) - @protected_tags = @project.protected_tags.order(:name).page(params[:page]) + @protected_tags = @project.protected_tags.order(:name).page(params[:page]) #TODO duplicated pagination param? @protected_branch = @project.protected_branches.new @protected_tag = @project.protected_tags.new load_gon_index diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb index 4f3500d998a..3681ae63e3a 100644 --- a/app/models/concerns/protected_ref.rb +++ b/app/models/concerns/protected_ref.rb @@ -18,8 +18,6 @@ module ProtectedRef self.matching(ref).map(&:"@#{action}_access_levels").flatten end - private - def self.matching(ref_name, protected_refs: nil) ProtectedRefMatcher.matching(self, ref_name, protected_refs: protected_refs) end diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index 2870cd9385b..08377127f69 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -1,3 +1,4 @@ +#TODO: Refactor, checking EE # module ProtectedRefAccess # extend ActiveSupport::Concern diff --git a/lib/gitlab/checks/change_access.rb b/lib/gitlab/checks/change_access.rb index 6f574a41727..07fd4024346 100644 --- a/lib/gitlab/checks/change_access.rb +++ b/lib/gitlab/checks/change_access.rb @@ -71,15 +71,15 @@ module Gitlab def protected_tag_checks return unless tag_protected? - if forced_push? - return "You are not allowed to force push protected tags." #TODO: Wording, 'not allowed to update proteted tags'? + if forced_push? #TODO: Verify if this should prevent all updates, and mention in UI and documentation + return "Protected tags cannot be updated." end if Gitlab::Git.blank_ref?(@newrev) - return "You are not allowed to delete protected tags." #TODO: Wording, do these need to mention 'you' if the rule applies to everyone + return "Protected tags cannot be deleted." end - if !user_access.can_push_tag?(@tag_name) + unless user_access.can_push_tag?(@tag_name) return "You are not allowed to create this tag as it is protected." end end diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index d44563333a5..9d269c5d384 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -7,7 +7,7 @@ module Gitlab triggers: 'Ci::Trigger', builds: 'Ci::Build', hooks: 'ProjectHook', - merge_access_levels: 'ProtectedBranch::MergeAccessLevel', + merge_access_levels: 'ProtectedBranch::MergeAccessLevel', #TODO: Tags push_access_levels: 'ProtectedBranch::PushAccessLevel', labels: :project_labels, priorities: :label_priorities, diff --git a/spec/controllers/projects/protected_tags_controller_spec.rb b/spec/controllers/projects/protected_tags_controller_spec.rb index 729017c1483..ac802981294 100644 --- a/spec/controllers/projects/protected_tags_controller_spec.rb +++ b/spec/controllers/projects/protected_tags_controller_spec.rb @@ -1,10 +1,10 @@ require('spec_helper') describe Projects::ProtectedTagsController do - # describe "GET #index" do - # let(:project) { create(:project_empty_repo, :public) } - # it "redirects empty repo to projects page" do - # get(:index, namespace_id: project.namespace.to_param, project_id: project) - # end - # end + describe "GET #index" do + let(:project) { create(:project_empty_repo, :public) } + it "redirects empty repo to projects page" do + get(:index, namespace_id: project.namespace.to_param, project_id: project) + end + end end