1. 29 Jul, 2016 15 commits
    • Timothy Andrew's avatar
      Admins count as masters too. · cc1cebdc
      Timothy Andrew authored
      1. In the context of protected branches.
      
      2. Test this behaviour.
      cc1cebdc
    • Timothy Andrew's avatar
      Make specs compatible with PhantomJS versions < 2. · 4d6dadc8
      Timothy Andrew authored
      1. These versions of PhantomJS don't support `PATCH` requests, so we use
         a `POST` with `_method` set to `PATCH`.
      4d6dadc8
    • Timothy Andrew's avatar
      Humanize protected branches' access levels at one location. · f2df2966
      Timothy Andrew authored
      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.
      f2df2966
    • Timothy Andrew's avatar
      Fix all specs related to changes in !5081. · c647540c
      Timothy Andrew authored
      1. Remove `Project#developers_can_push_to_protected_branch?` since it
         isn't used anymore.
      
      2. Remove `Project#developers_can_merge_to_protected_branch?` since it
         isn't used anymore.
      c647540c
    • Timothy Andrew's avatar
      Fix default branch protection. · a9958ddc
      Timothy Andrew authored
      1. So it works with the new data model for protected branch access levels.
      a9958ddc
    • Timothy Andrew's avatar
      Update protected branches spec to work with the `select`s. · 9fa66147
      Timothy Andrew authored
      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.
      9fa66147
    • Timothy Andrew's avatar
      Allow setting "Allowed To Push/Merge" while creating a protected branch. · 12387b4d
      Timothy Andrew authored
      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.
      12387b4d
    • Timothy Andrew's avatar
      Enforce "No One Can Push" during git operations. · 828f6eb6
      Timothy Andrew authored
      1. The crux of this change is in `UserAccess`, which looks through all
         the access levels, asking each if the user has access to push/merge
         for the current project.
      
      2. Update the `protected_branches` factory to create access levels as
         necessary.
      
      3. Fix and augment `user_access` and `git_access` specs.
      828f6eb6
    • Timothy Andrew's avatar
      Add "No One Can Push" to the protected branches UI. · ab6096c1
      Timothy Andrew authored
      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.
      ab6096c1
    • Timothy Andrew's avatar
      Add seeds for protected branches. · f8a04e15
      Timothy Andrew authored
      f8a04e15
    • Timothy Andrew's avatar
      Use the `{Push,Merge}AccessLevel` models in the UI. · 134fe5af
      Timothy Andrew authored
      1. Improve error handling while creating protected branches.
      
      2. Modify coffeescript code so that the "Developers can *" checkboxes
         send a '1' or '0' even when using AJAX. This lets us keep the backend
         code simpler.
      
      3. Use services for both creating and updating protected branches.
         Destruction is taken care of with `dependent: :destroy`
      134fe5af
    • Timothy Andrew's avatar
      Add models for the protected branch access levels. · 21bece44
      Timothy Andrew authored
      - And hook up their associations.
      21bece44
    • Timothy Andrew's avatar
      Add a series of migrations changing the model-level design of protected branch access levels. · f1e46d1e
      Timothy Andrew authored
      1. Remove the `developers_can_push` and `developers_can_merge` boolean
         columns.
      
      2. Add two new tables, `protected_branches_push_access`, and
         `protected_branches_merge_access`. Each row of these 'access' tables is
         linked to a protected branch, and uses a `access_level` column to
         figure out settings for the protected branch.
      
      3. The `access_level` column is intended to be used with rails' `enum`,
         with `:masters` at index 0 and `:developers` at index 1.
      
      4. Doing it this way has a few advantages:
      
         - Cleaner path to planned EE features where a protected branch is
           accessible only by certain users or groups.
      
         - Rails' `enum` doesn't allow a declaration like this due to the
           duplicates. This approach doesn't have this problem.
      
             enum can_be_pushed_by: [:masters, :developers]
             enum can_be_merged_by: [:masters, :developers]
      f1e46d1e
    • Yorick Peterse's avatar
      Merge branch 'cache-commit-author-lookup' into 'master' · 9b0e131b
      Yorick Peterse authored
      Cache the commit author in RequestStore to avoid extra lookups in PostReceive
      
      See merge request !5537
      9b0e131b
    • Yorick Peterse's avatar
      Merge branch... · 5161983b
      Yorick Peterse authored
      Merge branch '17073-tagscontroller-index-is-terrible-response-time-goes-up-to-5-seconds' into 'master'
      
      Update to gitlab_git 10.4.1 and take advantage of preserved Ref objects
      
      See merge request !5536
      5161983b
  2. 28 Jul, 2016 20 commits
  3. 27 Jul, 2016 5 commits
    • Stan Hu's avatar
      Add specs for caching commit author · d27e36f3
      Stan Hu authored
      d27e36f3
    • Stan Hu's avatar
      Cache the commit author in RequestStore to avoid extra lookups in PostReceive · 8a9fc2b6
      Stan Hu authored
      In a PostReceive task with 697 commits (8.9 RC1 -> RC8), looking up
      the commit author takes about 10% of the time. Caching this information
      in RequestStore saves a few seconds from the overall processing time.
      
      Improves #18663
      8a9fc2b6
    • Robert Speicher's avatar
      Merge branch 'rename-undefined-methods' into 'master' · 17be364d
      Robert Speicher authored
      Replace reject_blocked with reject_blocked! in skipped callbacks.
      
      `reject_blocked!` was introduced in c9def945, I can't find any references to `reject_blocked` ever existing.
      
      See merge request !5532
      17be364d
    • Connor Shea's avatar
      Replace reject_blocked with reject_blocked! in callbacks. · b1c94754
      Connor Shea authored
      In Rails 4.2 and below, skipping callbacks (skip_before_action, skip_after_action, etc.) that use methods which do not exist will not throw any errors.
      
      On the other hand, Rails 5 does. See https://github.com/rails/rails/pull/19029
      
      After testing with Rails 5 I noticed there are some methods that don't actually exist (because they were renamed, usually), this fixes a few instances of those.
      
      reject_blocked! was introduced in c9def945, I can't find any references to reject_blocked ever existing.
      b1c94754
    • Douwe Maan's avatar
      Merge branch 'akismet-ui-check' into 'master' · f6063bae
      Douwe Maan authored
      Submit new issues created via the WebUI or API to Akismet for spam check on public projects.
      
      ## What does this MR do?
      
      Submit new issues created via the WebUI by non project members to Akismet for spam check.
      
      ## Why was this MR needed?
      
      Support for Akismet was added only to the API with !2266. This MR builds on that functionality to also check issues submitted via the WebUI for spam.
      
      ## What are the relevant issue numbers?
      
      Related to:
      
      - #5573 
      - #5932 
      - gitlab-com/infrastructure#14
      - gitlab-com/support#61
      - !2266
      
      cc @stanhu @MrChrisW 
      
      See merge request !5333
      f6063bae