31846 Commits
Author SHA1 Message Date
Dmitriy Zaporozhets 440345bd97 Merge branch 'dz-subnav-darker' into 'master'
Make subnavigation a bit darker color



See merge request !5166
2016-07-09 09:16:53 +00:00
Dmitriy Zaporozhets 53697439cc Make subnavigation a bit darker color
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-07-09 11:42:48 +03:00
Dmitriy Zaporozhets 706f0e595b Merge branch 'dz-button-capitalize' into 'master'
Update ui_guide.md with button capitalize rule

cc @jschatz1 @hazelyang @skyruler 

See merge request !5161
2016-07-09 08:10:40 +00:00
Dmitriy Zaporozhets 3bae69aa5d Update ui_guide.md with button capitalize rule 2016-07-08 21:20:13 +00:00
Fatih Acet 697e9889b6 Merge branch 'new-snippet-button-permissions' into 'master'
Update New Snippet buttons.

## What does this MR do?

No longer shows New Snippet button to users who aren't able to create a new snippet in the given context.

Also removes the plus icon from the New Snippet buttons, as they're no longer used in other creation buttons.

## Are there points in the code the reviewer needs to double check?

Make sure the snippets pages don't break or show the buttons to users who shouldn't have access to them.

## Why was this MR needed?

Users that weren't logged in would click the New Snippet button and get a 404 error. You would also get 404 errors from the New Snippet button on project snippets for projects you weren't able to create snippets for.

## What are the relevant issue numbers?

Fixes #14595.

## Screenshots (if relevant)

Before:

![before1](/uploads/2c222cd981332d30772054cefadafa28/before1.png)

![before2](/uploads/2734f8a84ae293b08dd982f2ed7da028/before2.png)

After:

![after1](/uploads/c84aa9aec17056095271b0f24c6e9b5b/after1.png)

![after2](/uploads/70fe37ad7be5054bf20439ca0a1f5ccc/after2.png)

![after3](/uploads/afcd435c211482e9df25cb8971f1e65e/after3.png)

![after4](/uploads/9eab87440aae4991b508373ff36e3c7a/after4.png)

![after5](/uploads/f5ec167cb3e1115d3b3a43bd5231bc60/after5.png)

![after6](/uploads/c774cbb1f9babe3382ff69af7060b9c5/after6.png)

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4998
2016-07-08 19:52:21 +00:00
Connor Shea 226bc5873a Use btn-danger for delete button. 2016-07-08 13:21:20 -06:00
Connor Shea 443fdff1b4 Update New Snippet buttons.
No longer shows New Snippet button to users who aren't able to create a new snippet in the given context.

Also removes the plus icon from the New Snippet buttons, as they're no longer used in other creation buttons.

Fixes #14595.
2016-07-08 13:21:20 -06:00
Fatih Acet 57da2e8705 Merge branch 'cs-cropper' into 'master'
Split Cropper.js from the main JavaScript manifest.

## What does this MR do?

Splits Cropper.js from the main JavaScript file.

## Are there points in the code the reviewer needs to double check?

That the avatar uploader works. (It did in my testing)

## Why was this MR needed?

Smaller JS payload.

## What are the relevant issue numbers?

#14372 

## Does this MR meet the acceptance criteria?

- Tests
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4978
2016-07-08 19:03:11 +00:00
Rémy Coutable 79304c6a7f Merge branch 'improve-project-limit-field' into 'master'
Add min attribute to projects_limit field on user's form

This PR adds `min=0` attribute to `:projects_limit` field on user's form in the admin panel. It improves UX disallowing user to enter negative values in this field.

![](http://take.ms/70V8W)

See merge request !3622
2016-07-08 17:10:23 +00:00
Rémy Coutable df97d5514e Merge branch 'fix_gemfile' into 'master'
Fix gemfile

1. replace `"` to `'` in Gemfile.

2. change `require: nil` to `require: false`.
`require: nil` and `require: false` get same result, but i think we shouldn't write it differently in other places.

3. set version for gems.
better gem's version control for prevent dependency errors.

See merge request !5078
2016-07-08 16:54:57 +00:00
Robert Speicher 989a9607e6 Merge branch 'rubocop/enable-identical-conditional-branches-cop' into 'master'
Enable Style/IdenticalConditionalBranches Rubocop cop

## What does this MR do?

This MR enables Rubocop cop that checks for identical lines at the end of each branch of a conditional statement.

Examples:

```ruby
@bad
if condition
  do_x
  do_z
else
  do_y
  do_z
end

@good
if condition
  do_x
else
  do_y
end
do_z
```

## What are the relevant issue numbers?

#17478

See merge request !5011
2016-07-08 16:34:53 +00:00
Andrey Krivko 8e1a18f11f Add min attribute to project_limit field on user's form 2016-07-08 19:22:19 +03:00
Rémy Coutable 140a706e96 Merge branch 'retrieve-mr-closes-issues-just-when-required' into 'master'
Avoid calculation of closes_issues.

## What does this MR do?

Avoid unneeded calls to MR closes issues

## Are there points in the code the reviewer needs to double check?

I'm not sure if calling this method from a view is a good practice, but I cannot see another simple way of avoiding this problem. In case we want to avoid this in the controller we need to specify the action, format and status of the merge request, because in that case we know that the `_open` partial will render. We could add some lazy evaluation but it not a thing I see in use along the app but feedback is welcome

## What are the relevant issue numbers?

#14202 , #19490

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- ~~[ ] API support added~~
- Tests
  - ~~[ ] Added for this feature/bug~~
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5140
2016-07-08 16:13:08 +00:00
Robert Speicher e82c72d1f1 Merge branch 'fix-broken-mysql-migration' into 'master'
Fix broken migration in MySQL

`keys` is a reserved name in MySQL, so if this migration actually attempted to remove any duplicate keys it would fail.

Closes #19344

See merge request !5005
2016-07-08 16:11:45 +00:00
Rémy Coutable 09f4a8f8f5 Merge branch 'edgemaster/gitlab-ce-patch-missing-api-docs'
See !4096.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-08 17:52:53 +02:00
Rémy Coutable fa82fd1283 Merge branch 'clarify-github-integration-docs' into 'master'
Fix documentation for Github integration authorization callback url.

There are two callbacks that could be used with Github integration:

  * /import/github/callback (used by project import)
  * /users/auth/github/callback (used by OmniAuth)

Github's documentation suggests that authorization callback url should be
set to the longest common path.

https://developer.github.com/v3/oauth/#redirect-urls

Configuring according to the previous documentation resulted in a
redirect_uri_mismatch error from Github when logging in via OmniAuth.

See merge request !4111
2016-07-08 15:50:02 +00:00
Stan Hu b5a16faa93 Merge branch 'fix-changelog-typo' into 'master'
Fix CHANGELOG typo: by_pass -> bypass



See merge request !5048
2016-07-08 15:43:08 +00:00
Rémy Coutable 7393539fce Merge branch 'yatish27/gitlab-ce-project-commit-range-comment' into 'master'
Fix comment for project argument in commit_range.rb

## What does this MR do?
It fixes the documentation for commit_range project argument

## Are there points in the code the reviewer needs to double check?

## Why was this MR needed?

## What are the relevant issue numbers?

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- [ ] Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4805
2016-07-08 15:39:52 +00:00
Rémy Coutable 8bdb5b6aec Merge branch '1548-average-commits-per-day' into 'master'
Fix: Infinity Bug in Commit Statistics

## What does this MR do?

It fixes a logic bug in the commits statistics: The code assumed that the amount of days involved in a commit range is equal to the difference between the first and last date. This is not true, though, as (from a human standpoint), a commit yesterday and a commit today involve two days, not one. Similarly, a fresh project with only commits made today already 'used' one day.

Since the number of involved days used to be zero for new projects, the result for commits per day quite often amounted to `Infinity`…

## Are there points in the code the reviewer needs to double check?

The test file. I hope it is up to the standards of GitLab.

## Why was this MR needed?

The bug occurres especially for new users with their first project while exploring GitLab.

## What are the relevant issue numbers?

This bug was reported as #1548.

## Screenshots (if relevant)

See merge request !4231
2016-07-08 15:20:22 +00:00
Douwe Maan 4b21b45db1 Merge branch 'dont-render-discussion-notes-on-not-html-requests' 2016-07-08 11:01:24 -04:00
Rémy Coutable 14d08ee172 Merge branch 'patch-1' into 'master'
Fixed Typo in README.md

## What does this MR do?
Found a Typo in the README.md file.  before_script should be with ":"  Script didn't work for me without ":"

## Why was this MR needed?
Missing ":" can be irritating for new users.

See merge request !4419
2016-07-08 14:52:37 +00:00
Rémy Coutable 8657e327ff Merge branch 'api-shared-projects' into 'master'
Api shared projects

## What does this MR do?

Exposes the shared projects in the group endpoint

## What are the relevant issue numbers?

Builds upon !5148 and closes #18780

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5150
2016-07-08 14:30:35 +00:00
Rémy Coutable 7dba769886 Merge branch 'memoize_merge_request_events' into 'master'
Memoize MR merged/closed events retrieval

## What does this MR do?

Memoize a database call that is execute 3 consecutive times 

## Why was this MR needed?

To speed up MR pages

## What are the relevant issue numbers?

#14202 , #19490

## Screenshots (if relevant)

The query is fast most of the times, but we can avoid the 3 call counts to the database

![Screen_Shot_2016-07-08_at_12.49.48](/uploads/ab0f6d843be30754a06e0f05bdf2102d/Screen_Shot_2016-07-08_at_12.49.48.png)

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- ~~[ ] API support added~~
- Tests
  - ~~[ ] Added for this feature/bug~~
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5151
2016-07-08 14:16:42 +00:00
Robert SchillingandGitHub ad806f32dc Merge pull request #10368 from gsmetal/patch-1
Fix unarchive mistake in projects API documentation
2016-07-08 13:18:18 +02:00
Robert Schilling 33124b4b50 API: Expose shared projects in a group 2016-07-08 13:06:17 +02:00
Paco Guzman 52a89f2022 Memoize MR merged/closed events retrieval 2016-07-08 12:35:42 +02:00
Rémy Coutable 01d1be7bf1 Merge branch 'fix/import-url-migration' into 'master'
import_url migration performance improvements

 Nullifying empty import_urls upfront so the number of projects with import_url not NULL decreases to 1/5.

 Also, now processing batches in blocks of 1000, with a threaded process - a bit experimental.

See merge request !5149
2016-07-08 10:18:42 +00:00
Grzegorz Bizon 4c388fb865 Remove legacy conditional from irker service code 2016-07-08 11:06:54 +02:00
Grzegorz Bizon c6f9a1c273 Enable Style/IdenticalConditionalBranches Rubocop cop 2016-07-08 11:04:04 +02:00
James Lopez 2c6fe72265 fix thread join issue 2016-07-08 11:00:30 +02:00
James Lopez 6d09e946d2 import_url migration performance improvements
Nullifying empty import_urls upfront so the number of projects with import_url not NULL decreases to 1/5.

 Also, now processing batches in blocks of 1000, with a threaded process - a bit experimental.
2016-07-08 10:44:07 +02:00
Robert Schilling 0530ec5e6e Expose shared groups for projects 2016-07-08 10:30:52 +02:00
Rémy Coutable 2c650b6f30 Merge branch 'feature/option-set-new-users-external' into 'master'
Added setting to set new users by default as external

## What does this MR do?
This implements the feature request #14508. It adds an option in the application settings to set new users by default as external.

## Are there points in the code the reviewer needs to double check?
Everything. Like I mentioned in the discussion of the issue my knowledge of Ruby basically doesn't exists. I tested it on my machine and it seems to work, but as I am very unexperienced in Ruby I highly recommend to  take a close look at the code.

## Why was this MR needed?
It was requested by @DouweM to work on the issue with the proposed changes by me.

## What are the relevant issue numbers?
This MR is for the issue #14508 that followed up after the implementation of #4009.

See merge request !4545
2016-07-08 08:29:18 +00:00
Paco Guzman 8ab3ab9e0a Don't render discussion notes when requesting diff tab through AJAX 2016-07-08 07:35:49 +02:00
Robert Speicher 5d0b06a038 Merge branch '9127-link-report-to-profile' into 'master'
Link to the user's profile in the abuse reports

Link to the user's profile in the abuse reports and add a link to the
admin area view if the user viewing the profile is an admin

Fixes #9127

See merge request !5118
2016-07-08 04:59:40 +00:00
Robert Speicher 0de617772d Revert "Revert "Merge branch 'issue_3946' into 'master' ""
This reverts commit bf2a86b73c.
2016-07-07 23:48:02 -04:00
Robert Speicher cfb5a76bb2 Merge branch 'upgrade-oauth2' into 'master'
Upgrade oauth2 from 1.0.0 to 1.2.0.

Changelog: https://github.com/intridea/oauth2/compare/v1.0.0...v1.2.0

Follow-up on !3434 since 1.2.0 doesn't limit the JWT version we can use.

Adds support for Rails 5. Working toward #14286.

See merge request !5041
2016-07-07 23:53:57 +00:00
Patricio Cano be6c4fef40 Removed unnecessary id from links and corrected tests to use the proper matcher. 2016-07-07 18:39:45 -05:00
Douwe Maan 068b1aeef9 Merge branch 'prefer-scope' into 'master'
Use scope rather than class method

## What does this MR do?

Use scope rather than class method

## Why was this MR needed?

I assume this would be useful and more clear.

See merge request !5133
2016-07-07 22:47:48 +00:00
Douwe Maan 5d3a0d38cb Merge branch 'prefer-ref' into 'master'
Prefer ref rather than id because id is shadowing database id

## What does this MR do?

Just a local variable renaming.

## Why was this MR needed?

Prefer ref rather than id because id is shadowing database id.

See merge request !5134
2016-07-07 22:47:38 +00:00
Robert Speicher dad406da23 Merge remote-tracking branch 'origin/master' 2016-07-07 18:40:29 -04:00
Douwe Maan bf89e06a45 Merge branch '18627-wildcard-branch-protection' into 'master'
Allow specifying protected branches using wildcards

Closes #18627 

# Tasks

- [ ]  #18627 !4665 Allow specifying protected branches using wildcards
    - [x]  Find existing usages of protected branches
        - Protecting branches
            - `ProtectedBranchesController` is used to mark a branch protected/unprotected
            - `API::Branches` can be used to mark a branch protected/unprotected
        - Enforcing branch protection
            - `Gitlab::GitAccess` has helpers (`can_push_to_branch?`, `check`) that are used to deny pushes if a branch is protected
            - Over SSH: `gitlab-shell` receives a push, and calls `/allowed` on the GitLab API, which calls `GitAccess.check`
            - Over HTTP: 
                - `gitlab-workhorse` receives the request, and forwards it to rails
                - Rails (in the `GitHttpController#git-recieve-pack`) runs basic checks (is the user logged in, not protected branch checks) and returns ok with `GL_ID` and `RepoPath`
                - `gitlab-workhorse` looks at the response, and calls the relevant `gitlab-shell` action from `git-http/handlePostRPC`
                - Rest of this flow is the same as the SSH flow above
    - [x]  Implementation
        - [x]  Backend
            - [x]  Change `project#protected_branch?` to look at wildcard protected branches
            - [x]  Change `project#developers_can_push_to_protected_branch?`
            - [x]  Change `project#open_branches`
            - [x]  Better error message when creating a disallowed branch from the Web UI
        - [x]  Frontend
            - [x]  Protected branches page should allow typing out a wildcard pattern
            - [x]  Add help text explaining the use of wildcards
            - [x]  Show matching branches for each protected branch
                - [x]  ~~On the index page~~
                - [x]  On a show page
                - [x]  Index?
            - [x]  Can't have the "last commit" column for wildcard protected branches
    - [x]  Fix / write tests
    - [x]  What happens if a hook is missing in dev?
    - [x]  Refactor
    - [x]  Test workflows
        - Create a branch matching a wildcard pattern
        - Push to a branch matching a wildcard pattern
        - Force push to a branch matching a wildcard pattern
        - Delete a branch matching a wildcard pattern
        - [x]  Test using Web UI
        - [x]  Test over SSH
        - [x]  Test over HTTP
        - [x]  Test as developer and master
    - [x]  Investigate performance
        - [x]  Test with a large number of protected branches / branches
        - [x]  Paginate list of protected branches
        - [x]  ~~Possibly rewrite `open_branches`~~
    - [x]  Add `iid`s to existing `ProtectedBranch`es
    - [x]  Add documentation
    - [x]  Add CHANGELOG entry
    - [x]  Add screenshots
    - [x]  Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/2f753e3ed2ce681b4444944d521f4419e8ed37f7/builds) passes
    - [x]  Assign to endboss for review
    - [x]  Address @DouweM's comments
        - [x]  `protected_branch_params`
        - [x]  `exact_match` instead of `explicit_match`
        - [x]  When would self.name be blank?
        - [x]  Move `protected_branches.each` to a partial
        - [x]  Move `matching_branches.each` to a partial
        - [x]  If the branch is in @matching_branches, it's not been removed
        - [x]  move this regex to a method and memoize it
        - [x]  `commit_sha` directly for exact matches
        - [x]  Number of matches for wildcard matches, with a link
    - [x]  Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/43f9ce0e88194b8f719bb1c1e656b7fc13278d56/builds) to pass
    - [x]  Respond to @DouweM's comments
        - [x]  Don't use iid
        - [x]  Controller should use `@project.protected_branches.new`
        - [x]  move the memoization to `def wildcard_regex`
        - [x]  render with `collection: @protected_branches`
    - [x]  Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/f7beedf122fa0c7aa89e86181fe7499321fb10ca/builds) to pass
    - [x]  Wait for @DouweM's review
    - [x]  Wait for @jschatz1's review
    - [x]  Respond to @jschatz1's comments
        - [x]  Use the new dropdown style
        - [x]  description should be moved to the description section without the styling
        - [x]  Protect button should be disabled when no branch is selected
    - [x]  Update screenshots
    - [x]  Merge conflicts
    - [x]  Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/20f3cfe8d5540eab64c2ba548043d600b28c61ba/builds) passes
    - [ ]  Revisit performance, possibly with staging/production data
        - [ ]  Get a dump of staging / run against staging live
            - [ ]  Get SSH access to staging
    - [ ]  Wait for review/merge






# Screenshots

## Creating wildcard protected branches

![1](/uploads/9446afccfdf6fa381e00c800dd2cc82e/1.png)
![2](/uploads/0b154503b297a818d3577488c575d845/2.png)
![3](/uploads/36217f79df9e41cc1550601f02627fe8/3.png)
![4](/uploads/041ca9bd529bcfa5373fca67e917cbcb/4.png)

### Using the `GLDropdown` component

![2016-06-30_14-16-15](/uploads/508afc2a5e2463c2954641409a560d88/2016-06-30_14-16-15.gif)

## Enforcing wildcard protected branches

### From the Web UI

![Screen_Shot_2016-06-20_at_1.21.18_PM](/uploads/8b5d4b1911e9152698a0488daf1880bc/Screen_Shot_2016-06-20_at_1.21.18_PM.png)

### Over SSH

![SSH](/uploads/7365989d7e4c406ef37b6ae5106442c9/SSH.gif)

### Over HTTPS

![HTTPS](/uploads/a7c0f56ae58efcffc75e6700fa2f4ac0/HTTPS.gif)

## Listing matching branches

![Screen_Shot_2016-06-20_at_1.33.44_PM](/uploads/d054113022f5d7ec64c0e57e501ac104/Screen_Shot_2016-06-20_at_1.33.44_PM.png)

See merge request !4665
2016-07-07 22:37:30 +00:00
Robert Speicher bf2a86b73c Revert "Merge branch 'issue_3946' into 'master' "
This reverts commit 68155ee73b, reversing
changes made to 7ebd011ed1.
2016-07-07 18:25:05 -04:00
Robert Speicher 39fbec9419 Merge branch '18181-pipeline-duration' into 'master'
Update time format of pipeline duration

Closes #18181

Part of #18920 

See merge request !5121
2016-07-07 22:17:55 +00:00
Annabel Dunstone 4498bb7833 Change 3600 to 1.hour 2016-07-07 16:48:10 -05:00
Jacob Schatz 5541e55c49 Merge branch 'issues-blank-state' into 'master'
Added blank state to issues

## What does this MR do?

Adds new blank state to issues when no issues exist.

Part of #18519 

## Screenshots (if relevant)

![Screen_Shot_2016-06-24_at_16.37.12](/uploads/0c3f385615b29216ef1137bd6fac06af/Screen_Shot_2016-06-24_at_16.37.12.png)

See merge request !4908
2016-07-07 21:17:23 +00:00
Douwe Maan 86d238e4bd Merge branch 'new-diff-notes' into 'master'
New diff notes

Fixes #12732, #14731, #19375, #14783 

Builds on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4110

To do:
- [x] Get it mostly working
- [x] Validate position validity
- [x] Fix: Don’t link to `#`
- [x] Fix: Base ref can be `nil`, potentially, when the MR has an oprhan source branch => Yep, doesn’t work. We need to store a `start_id`
- [x] Optimize: Fewer duplicate `git diff` compares
- [x] Optimize: Pass paths to `PositionTracer#diff` for faster diffs
- [x] Refactor: Use `head_id` in `MergeRequest`/`MergeRequestDiff` instead of `source_sha`
- [x] Refactor: Convert existing array-based diff refs to the DiffRefs model
- [x] Tweak: Use `note_type` in `Autosave` key
- [x] Tweak: Remove `line_code: note.line_code` from `link_to_reply_discussion`
- [x] Update: `SentNotifications` and reply-by-email receiver
- [x] Update: MR diff notification email
- [x] Update: API (MR, Commit note creation and entity)
- [x] Update: GitHub importer
- [x] Address any other TODO comments
- [x] Fix: Suppress "edited 4 minutes ago"
- [x] Write tests
  - [x] `LineMapper`
  - [x] `PositionTracer`
  - [x] `Position`
  - [x] `DiffPositionUpdateService`
  - [x] `DiffNote`
  - [x] `MergeRequests::RefreshService` / `MergeRequest#update_diff_notes_positions`
- [x] Make sure commits with diff notes don't get cleaned up, since this would prevent the diff notes from being rendered (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5062)

Future improvements:
- Display unresolved comments on files outside the diff, if the comment was added when that file _was_ part of the diff
- Allow commenting on sections between hunks, when expanding the diff using `...`
  - (We'd need to generate line code based on Position if we have it, even if it falls outside bounds of diff)
- `diff_hunk` on diff note API entity
- Show diff hunk in notification email
- Resolved line notes would have a boolean, and be inactive through `notes.any? { !active? || resolved? }`
- Multi line notes would store a number of positions, and do the right thing (™) in grouping and then rendering if the first item is multiline? => true
- Image diff notes could store x,y,width,height instead of old_line,new_line for similar grouping. Does it need a reference to say if it's on old or new? These can't have line_codes, clearly. Rendering would be interesting.
- Show commit line comments in the MR diff
- Comment on specific selected words
- Comment on file header
- Unfold top of discussion diff note
- New diff notes API for commits and MRs

/cc @rspeicher

See merge request !4101
2016-07-07 20:45:03 +00:00
Robert Speicher 91cf0387dd Merge branch 'pending-delete-project-notifications' into 'master'
Exclude projects pending delete from notifications

Make `NotificationSetting.for_projects` exclude projects that are excluded by the default scope on `Project`. (At the moment, that's projects with `pending_delete: true`.)

See https://gitlab.com/gitlab-com/support-forum/issues/819

See merge request !5138
2016-07-07 20:17:24 +00:00
Douwe Maan c66bcf34dd Add comment with diff to DiffPositionUpdateService spec 2016-07-07 16:14:57 -04:00
Douwe Maan 14c2b9683a Use HAML class syntax in diff line partials 2016-07-07 16:14:18 -04:00