Skip to content

Extract checks for showing create button into a helper method

Instead of keeping these checks in the template, we should move it to a helper method.

The following discussion from !204462 (merged) should be addressed:

  • @smaglangit started a discussion: (+1 comment)

    suggestion (non-blocking): What do you think about extracting this into a helper method so we can minimize the logic in the HAML template?

    def show_create_registry_button?(group)
        can_create_virtual_registry?(@roup) && ::VirtualRegistries.registries_count_for(group, registry_type: 'maven') < VirtualRegistries::Packages::Maven::Registry::MAX_REGISTRY_COUNT
    end
Edited by 🤖 GitLab Bot 🤖