Commit Graph

21 Commits

Author SHA1 Message Date
Luke Bennett 9b1879f014
Resolve CE/EE diffs in protected branches
Part of single codebase changes.
2019-05-16 16:09:21 +01:00
Bob Van Landuyt 9654295dbb Use shared protected branches views for CE-partials 2017-07-14 10:26:26 +02:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Douwe Maan ff82acf343 Consistently use monospace font for commit SHAs and branch and tag names 2017-05-12 09:55:25 -05:00
Jose Ivan Vargas 2ee8644115 Fixed tests, changed dispatcher routing to the 'repository:show'
Also modified the render calls to the deploy_keys and protected_branches
partials
2017-03-06 09:47:44 -06:00
Alfredo Sumaran 588dc31af5 Remove unused attributes 2016-09-22 12:58:11 -05:00
Timothy Andrew e9f483355e Move the "update" portion of the protected branch view into a partial.
1. To improve EE compatibility.
2016-08-16 12:08:10 +05:30
Timothy Andrew e805a64700 Backport changes from gitlab-org/gitlab-ee!581 to CE.
!581 has a lot of changes that would cause merge conflicts if not
properly backported to CE. This commit/MR serves as a better
foundation for gitlab-org/gitlab-ee!581.

= Changes =

1. Move from `has_one {merge,push}_access_level` to `has_many`, with the
   `length` of the association limited to `1`. This is _effectively_ a
   `has_one` association, but should cause less conflicts with EE, which
   is set to `has_many`. This has a number of related changes in the
   views, specs, and factories.

2. Make `gon` variable loading more consistent (with EE!581) in the
   `ProtectedBranchesController`. Also use `::` to prefix the
   `ProtectedBranches` services, because this is required in EE.

3. Extract a `ProtectedBranchAccess` concern from the two access level
   models. This concern only has a single `humanize` method here, but
   will have more methods in EE.

4. Add `form_errors` to the protected branches creation form. This is
   not strictly required for EE compatibility, but was an oversight
   nonetheless.
2016-08-16 11:05:14 +05:30
Alfredo Sumaran c2912b46f8 Add custom css class to each dropdown to fix failing spec 2016-08-05 17:19:01 -05:00
Alfredo Sumaran 2b2c42a1fa Refactor of Protected Branch Edit List 2016-08-05 17:19:01 -05:00
Alfredo Sumaran 1ac953dab4 Update layout and JS for create protected branch.
Also updates protect branch list
2016-08-05 17:19:01 -05:00
Timothy Andrew 0a8aeb46dc Use `Gitlab::Access` to protected branch access levels.
1. It makes sense to reuse these constants since we had them duplicated
   in the previous enum implementation. This also simplifies our
   `check_access` implementation, because we can use
   `project.team.max_member_access` directly.

2. Use `accepts_nested_attributes_for` to create push/merge access
   levels. This was a bit fiddly to set up, but this simplifies our code
   by quite a large amount. We can even get rid of
   `ProtectedBranches::BaseService`.

3. Move API handling back into the API (previously in
   `ProtectedBranches::BaseService#translate_api_params`.

4. The protected branch services now return a `ProtectedBranch` rather
   than `true/false`.

5. Run `load_protected_branches` on-demand in the `create` action, to
   prevent it being called unneccessarily.

6. "Masters" is pre-selected as the default option for "Allowed to Push"
   and "Allowed to Merge".

7. These changes were based on a review from @rymai in !5081.
2016-07-29 15:20:39 +05:30
Timothy Andrew b3a29b3180 Favor labels like `Allowed to push` over `Allowed To Push`.
- Based on feedback from @axil
- http://docs.gitlab.com/ce/development/ui_guide.html#buttons
2016-07-29 15:20:39 +05:30
Timothy Andrew f2df2966aa Humanize protected branches' access levels at one location.
1. The model now contains this humanization data, which is the once
   source of truth.

2. Previously, this was being listed out in the dropdown component as well.
2016-07-29 15:20:39 +05:30
Timothy Andrew 9fa661472e Update protected branches spec to work with the `select`s.
1. Get the existing spec passing.

2. Add specs for all the access control options, both while creating and
   updating protected branches.

3. Show a flash notice when updating protected branches, primarily so
   the spec knows when the update is done.
2016-07-29 15:20:39 +05:30
Timothy Andrew 12387b4d2c Allow setting "Allowed To Push/Merge" while creating a protected branch.
1. Reuse the same dropdown component that we used for updating these
   settings (`ProtectedBranchesAccessSelect`). Have it accept options
   for the parent container (so we can control the elements it sees) and
   whether or not to save changes via AJAX (we need this for update, but
   not create).

2. Change the "Developers" option to "Developers + Masters", which is
   clearer.

3. Remove `developers_can_push` and `developers_can_merge` from the
   model, since they're not needed anymore.
2016-07-29 15:20:39 +05:30
Timothy Andrew ab6096c172 Add "No One Can Push" to the protected branches UI.
1. Move to dropdowns instead of checkboxes. One each for "Allowed to
   Push" and "Allowed to Merge"

2. Refactor the `ProtectedBranches` coffeescript class into
   `ProtectedBranchesAccessSelect`.

3. Modify the backend to accept the new parameters.
2016-07-29 15:20:39 +05:30
Rémy Coutable 2cf7f09b1e
Revert "Revert "Merge branch '18193-developers-can-merge' into 'master' ""
This reverts commit 530f5158e2.

See !4892.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-18 10:16:56 +02:00
Robert Speicher 530f5158e2 Revert "Merge branch '18193-developers-can-merge' into 'master' "
This reverts commit 9ca633eb4c, reversing
changes made to fb229bbf79.
2016-07-13 13:57:30 -05:00
Mathias Vestergaard f0577d8385 Added "developers can merge" setting to protected branches
- Cherry-picked from `mvestergaard:branch-protection-dev-merge`
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4220
2016-07-13 13:24:26 +05:30
Timothy Andrew 2a5cb7ec52 Modify the frontend for wildcard protected branches.
1. Allow entering any branch name for a protected branch.

    - Either pick from a list of options, or enter it manually
    - You can enter wildcards.

2. Display branches matching a protected branch.

    -  Add a `ProtectedBranches#show` page that displays the branches
       matching the given protected branch, or a message if there are no
       matches.

    - On the `index` page, display the last commit for an exact match,
      or the number of matching branches for a wildcard match.

    -  Add an `iid` column to `protected_branches` - this is what we use for
       the `show` page URL.

    -  On the off chance that this feature is unnecessary, this commit
       encapsulates it neatly, so it can be removed without affecting
       anything else.

3. Remove the "Last Commit" column from the list of protected branches.

    - There's no way to pull these for wildcard protected branches, so it's
      best left for the `show` page.

    - Rename the `@branches` instance variable to `@protected_branches`

    - Minor styling changes with the "Unprotect" button - floated right
      like the "Revoke" button for personal access tokens

4. Paginate the list of protected branches.

5. Move the instructions to the left side of the page.
2016-07-05 10:50:34 +05:30