Commit Graph

468 Commits

Author SHA1 Message Date
Douwe Maan c8b63a28af Improve performance of finding last deployed environment 2017-02-06 16:12:24 -06:00
Douwe Maan 27f2ca9418 Add 'View on [env]' link to blobs and individual files in diffs 2017-02-06 16:12:23 -06:00
Oswaldo Ferreira 0e14a2f21d Add commment to Issue, Project and MergeRequest #to_reference 2017-01-27 20:20:18 -02:00
Oswaldo Ferreira 660a755cad Change argument name assuming its always a Project 2017-01-27 20:20:18 -02:00
Sean McGivern 448321a46e Merge branch 'fix_broken_diff_discussions' into 'master'
Make diff discussions more reliable

Closes #23646

See merge request !8378
2017-01-25 09:54:34 +00:00
Sean McGivern d3f26be6f0 Merge branch '23524-notify-automerge-user-of-failed-build' into 'master'
Notify the user who set auto-merge when merge is not possible

Closes #23524

See merge request !8056
2017-01-19 11:05:38 +00:00
twonegatives 85e0b99471 Notify the user who set auto-merge when merge conflict occurs 2017-01-14 12:22:30 +03:00
Jarka Kadlecova 7ab3dd4b30 support `/merge` slash comand for MRs 2017-01-11 08:48:07 -05:00
Mike Greiling ba5ba96f2b prevent 500 error when selecting changes tab for non-existent branch 2017-01-03 13:08:52 -06:00
James Lopez 112f470572 Fix cross-project references copy to include the project reference
Also added relevant specs and refactored to_references in a bunch of places to be more consistent.
2017-01-03 13:01:46 +01:00
Valery Sizov 95047f1dc7 Make diff discussion more reliable 2016-12-30 17:42:27 +02:00
Gabriel Gizotti 38dd9b545c use MergeRequest#closes_issues instead of rewriting code to retrieve closing issues on MergeRequest#issues_mentioned_but_not_closing 2016-12-28 23:22:31 +10:00
Sean McGivern ed6900caf1 Use raw_diffs to calculate MR files changed
We don't need to create the intermediate FileCollection object with its
associated highlighting in order to count how many files changed. Both
the compare object and the MR diff object have a raw_diffs method that
is perfectly fine for this case.
2016-12-26 14:27:20 +00:00
Rémy Coutable 8c8c4f8c5a Merge branch 'fix/import-export-mr-error' into 'master'
Fix import/export merge requests error

When MWBS is set and the MR exported/imported an error gets thrown. We should ignore this so it can succeed as the merge user may no longer exist in the target instance.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24009 and https://gitlab.com/gitlab-com/support-forum/issues/1345

See merge request !8134
2016-12-19 18:03:06 +00:00
James Lopez 0631c7bcdc Fix MR issue to do with merge user 2016-12-19 16:52:38 +01:00
Gabriel Gizotti 3e3d6b53dc Change closes issues reference text on MergeRequest#merge_commit_message to match existing text generated by the system 2016-12-16 19:15:07 +10:00
Gabriel Gizotti 7d7ae494d4 add guard clause to MergeRequest#issues_mentioned_but_not_closing 2016-12-16 19:13:17 +10:00
Gabriel Gizotti 603ef5d49e Show either description or closes issues references on MergeRequest#merge_commit_message so closes issues references are not duplicated 2016-12-16 19:13:17 +10:00
Gabriel Gizotti 4181528569 Better `Closes issues` text for MergeRequest#merge_commit_message 2016-12-16 19:13:17 +10:00
Gabriel Gizotti 58609f842e backend completely drives creation of merge commit message 2016-12-16 19:13:17 +10:00
Gabriel Gizotti 512c870ed4 Remove unnecessary code from MergeRequest#issues_mentioned_but_not_closing 2016-12-16 19:13:17 +10:00
Gabriel Gizotti b4764a8dd2 shorter lines on MergeRequest#merge_commit_message 2016-12-16 19:13:17 +10:00
Gabriel Gizotti 0e76daf3da only look for issues mentioned on description on MergeRequest#issues_mentioned_but_not_closing 2016-12-16 19:13:17 +10:00
Gabriel Gizotti 1a8f43ff3e introduce MergeRequest#issues_mentioned_but_not_closing 2016-12-16 19:13:17 +10:00
Gabriel Gizotti e52e3ab508 Remove whole description from #merge_commit_message and add add closed issues 2016-12-16 19:13:17 +10:00
Douwe Maan 12db4cc0e7 Merge branch 'jej-note-search-uses-finder' into 'security'
Fix missing Note access checks in by moving Note#search to updated NoteFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

## Which fixes are in this MR?

⚠️ - Potentially untested  
💣 - No test coverage  
🚥 - Test coverage of some sort exists (a test failed when error raised)  
🚦 - Test coverage of return value (a test failed when nil used)  
 - Permissions check tested

### Note lookup without access check

- [x]  app/finders/notes_finder.rb:13 :download_code check
- [x]  app/finders/notes_finder.rb:19 `SnippetsFinder`
- [x]  app/models/note.rb:121 [`Issue#visible_to_user`]
- [x]  lib/gitlab/project_search_results.rb:113
  - This is the only use of `app/models/note.rb:121` above, but importantly has no access checks at all. This means it leaks MR comments and snippets when those features are `team-only` in addition to the issue comments which would be fixed by `app/models/note.rb:121`.
  - It is only called from SearchController where `can?(current_user, :download_code, @project)` is checked, so commit comments are not leaked.

### Previous discussions
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_13_13 `: download_code` check on commit
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_19_19 `SnippetsFinder` should be used
  - `SnippetsFinder` should check if the snippets feature is enabled -> https://gitlab.com/gitlab-org/gitlab-ce/issues/25223

###  Acceptance criteria met?
- [x] Tests added for new code
- [x] TODO comments removed
- [x] Squashed and removed skipped tests
- [x] Changelog entry
- [ ] State Gitlab versions affected and issue severity in description
- [ ] Create technical debt issue for NotesFinder.
  - Either split into `NotesFinder::ForTarget` and `NotesFinder::Search` or consider object per notable type such as `NotesFinder::OnIssue`. For the first option could create `NotesFinder::Base` which is either inherited from or which can be included in the other two.
  - Avoid case statement anti-pattern in this finder with use of `NotesFinder::OnCommit` etc. Consider something on the finder for this? `Model.finder(user, project)`
  - Move `inc_author` to the controller, and implement `related_notes` to replace `non_diff_notes`/`mr_and_commit_notes`

See merge request !2035
2016-12-15 11:40:12 -03:00
Adam Niedzielski 9190cea215 Do not reload diff for merge request made from fork when target branch in fork is updated
The target branch of a merge request has to be a branch in the project
for which the merge request is submitted. When a branch changes in a fork,
it does not make sense to reload diffs of merge requests in the upstream
project that use the same branch name as the target branch.
Please note that it does make sense to reload diffs when the source branch
changes.
2016-12-09 12:10:26 +01:00
Douwe Maan f23b1cb453 Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security'
Replace MR access checks with use of MergeRequestsFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

⚠️ - Potentially untested
💣 - No test coverage
🚥 - Test coverage of some sort exists (a test failed when error raised)
🚦 - Test coverage of return value (a test failed when nil used)
 - Permissions check tested

- [x] 💣  app/finders/notes_finder.rb:17
- [x] ⚠️  app/views/layouts/nav/_project.html.haml:80 [`.count`]
- [x] 💣  app/controllers/concerns/creates_commit.rb:84
- [x] 🚥  app/controllers/projects/commits_controller.rb:24
- [x] 🚥  app/controllers/projects/compare_controller.rb:56
- [x] 🚦  app/controllers/projects/discussions_controller.rb:29
- [x]   app/controllers/projects/todos_controller.rb:27
- [x] 🚦  app/models/commit.rb:268
- [x]  lib/gitlab/search_results.rb:71

- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#d1c10892daedb4d4dd3d4b12b6d071091eea83df_267_266 Memoize ` merged_merge_request(current_user)`
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#d1c10892daedb4d4dd3d4b12b6d071091eea83df_248_247 Expected side effect for `merged_merge_request!`, consider `skip_authorization: true`.
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#d1c10892daedb4d4dd3d4b12b6d071091eea83df_269_269 Scary use  of unchecked `merged_merge_request?`

See merge request !2033
2016-12-08 21:42:07 -03:00
Sean McGivern d9ef41cf4d Merge branch '23589-open-issue-for-mr' into 'master'
Create an issue for all unresolved discussions in an MR

See merge request !7180
2016-12-06 14:04:14 +00:00
Bob Van Landuyt 1123057ab7 Feature: delegate all open discussions to Issue
When a merge request can only be merged when all discussions are
resolved. This feature allows to easily delegate those discussions to a
new issue, while marking them as resolved in the merge request.

The user is presented with a new issue, prepared with mentions of all
unresolved discussions, including the first unresolved note of the
discussion, time and link to the note.

When the issue is created, the discussions in the merge request will get
a system note directing the user to the newly created issue.
2016-12-05 20:55:45 +01:00
Oswaldo Ferreira f272ee6eba Add shorthand support to gitlab markdown references 2016-12-02 19:18:17 -02:00
Adam Niedzielski cb6f8cdfc2 Replace references to MergeRequestDiff#commits with st_commits
when we care only about the number of commits

We do not have to instantiate all objects in this case.
2016-12-01 12:17:30 +01:00
Grzegorz Bizon a49e9949c6 Rename `MergeRequest#pipeline` to `head_pipeline` 2016-11-29 14:12:49 +01:00
Adam Niedzielski d9a2093e7e Prevent error when submitting a merge request and pipeline is not defined 2016-11-28 12:03:59 +01:00
Douwe Maan d8f7523368 Merge branch 'events-cache-invalidation' into 'master'
Remove caching of events data

This MR removes the caching of events data as this was deemed unnecessary while increasing load on the database. See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6578#note_18864037 and 5371da341e for more information.

See merge request !6578
2016-11-28 03:34:12 +00:00
Yorick Peterse 5371da341e
Remove event caching code
Flushing the events cache worked by updating a recent number of rows in
the "events" table. This has the result that on PostgreSQL a lot of dead
tuples are produced on a regular basis. This in turn means that
PostgreSQL will spend considerable amounts of time vacuuming this table.
This in turn can lead to an increase of database load.

For GitLab.com we measured the impact of not using events caching and
found no measurable increase in response timings. Meanwhile not flushing
the events cache lead to the "events" table having no more dead tuples
as now rows are only inserted into this table.

As a result of this we are hereby removing events caching as it does not
appear to help and only increases database load.

For more information see the following comment:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6578#note_18864037
2016-11-23 14:17:07 +01:00
Douwe Maan f2a0c6f6bf Correctly determine mergeability of MR with no discussions 2016-11-23 20:02:14 +08:00
Rémy Coutable 1a5eedf3fe
Fix a wrong "The build for this merge request failed" message
Also allow merge request to be merged with skipped pipeline and the
"only allow merge when pipeline is green" feature enabled

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-21 14:22:28 +01:00
Grzegorz Bizon 5328e3b127 Make commit an optional arg for environments search 2016-11-09 14:46:36 +01:00
Rodolfo Santos 1db9f826c1 Add setting to only allow merge requests to be merged when all discussions are resolved
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-04 14:58:40 +01:00
Rémy Coutable 46689162a3 Ensure merge request's "remove branch" accessors return booleans
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-03 18:29:00 +01:00
Guilherme Salazar 32913b74b8 add "x of y tasks completed" on issuable
fix issues pointed out in !6527

add task completion status feature to CHANGELOG
2016-10-28 14:01:36 -02:00
David Wagner 03b6108f6f Remove redundant class_name and foreign_key overrides
They were Rails' default and are unnecessarily overridden.

Signed-off-by: David Wagner <david@marvid.fr>
2016-10-24 22:29:48 +02:00
Nick Thomas 61536ed2cf Rename forked_source_project_missing? to source_project_missing? 2016-10-20 12:24:27 +01:00
Nick Thomas 374071321d Fix the merge request view when source projects or branches are removed 2016-10-20 12:24:27 +01:00
Nick Thomas e6f515ecbe Revert "Add #closed_without_source_project?"
This reverts commit 31c37c6c38.

See #23341
2016-10-20 01:31:54 +01:00
Douglas Barbosa Alexandre fc2c64fcdf Add self.project_foreign_key on both Issue and MergeRequest 2016-10-19 14:58:28 -02:00
Grzegorz Bizon 72d84e4851 Improve code that creates a list of commits for MR 2016-10-18 08:32:17 -05:00
Grzegorz Bizon ab8ef17fb2 Extend merge request tests for all commits method 2016-10-18 08:32:17 -05:00
Grzegorz Bizon d5b1d0ea50 Use temporary compare commits when MR not persisted 2016-10-18 08:32:17 -05:00