summaryrefslogtreecommitdiff
path: root/app/models
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'dz-nested-group-improvements-2' into 'master' Sean McGivern2016-12-131-3/+4
|\ | | | | | | | | Minor improvements to nested groups code See merge request !8011
| * Rename Routable.where_paths_in to Routable.where_full_path_indz-nested-group-improvements-2Dmitriy Zaporozhets2016-12-111-3/+3
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Validate presence of route by Routable concernDmitriy Zaporozhets2016-12-111-0/+1
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'grapify-service-api' into 'master' Rémy Coutable2016-12-125-15/+18
|\ \ | |/ |/| | | | | | | | | Grapify the service API Related to #22928 See merge request !7970
| * Grapify the service APIRobert Schilling2016-12-095-15/+18
| |
* | Do not reload diff for merge request made from fork when target branch in ↵do-not-refresh-main-when-fork-target-branch-updatedAdam Niedzielski2016-12-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'dz-nested-groups' into 'master' Douwe Maan2016-12-094-85/+122
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add nested groups support on data level ## What does this MR do? - [x] Add `parent_id` field to `Namespace`model. - [x] Create new database table `routes` that keeps information about full path to each group or project - [x] Remove uniq index from `namespaces.path` - [x] Add uniq index on `routes.path` - [x] Fill routes table with path data from namespaces and projects - [x] Change Namespace/Project URL lookup by routes table - [x] Rename related routes (nested groups, projects) when parent path changes This is solely backend preparation. UI, Permissions and API support will be added in separate merge request. ## Are there points in the code the reviewer needs to double check? migrations, Route model, Routable concern Will require downtime. See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7121#note_19490281 discussion ## Why was this MR needed? One step further to full nested groups support ## Screenshots (if relevant) No UI changes in this merge request so far ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added~~ - ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - ~~API support added~~ - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [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 it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/2772 See merge request !7121
| * | Add nested groups support on data leveldz-nested-groupsDmitriy Zaporozhets2016-12-084-85/+122
| | | | | | | | | | | | | | | | | | | | | | | | * add parent_id field to namespaces table to store relation with nested groups * create routes table to keep information about full path of every group and project * project/group lookup by full path from routes table Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | | Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security'Douwe Maan2016-12-084-22/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MR access checks with use of MergeRequestsFinder Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867 :warning: - Potentially untested :bomb: - No test coverage :traffic_light: - Test coverage of some sort exists (a test failed when error raised) :vertical_traffic_light: - Test coverage of return value (a test failed when nil used) :white_check_mark: - Permissions check tested - [x] :bomb: app/finders/notes_finder.rb:17 - [x] :warning: app/views/layouts/nav/_project.html.haml:80 [`.count`] - [x] :bomb: app/controllers/concerns/creates_commit.rb:84 - [x] :traffic_light: app/controllers/projects/commits_controller.rb:24 - [x] :traffic_light: app/controllers/projects/compare_controller.rb:56 - [x] :vertical_traffic_light: app/controllers/projects/discussions_controller.rb:29 - [x] :white_check_mark: app/controllers/projects/todos_controller.rb:27 - [x] :vertical_traffic_light: app/models/commit.rb:268 - [x] :white_check_mark: 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
* | | Merge branch 'pipeline-stage' into 'master' Rémy Coutable2016-12-084-33/+68
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refine pipeline stages ## What does this MR do? Introduces a concept of `Ci::Stage` to make it easier to have detailed statuses. ## Why was this MR needed? This is needed to simplify the handling of `Ci::Statuses` and make the `Stage` actual concept in code: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7889 See merge request !7927
| * | | Code reviewKamil Trzcinski2016-12-071-1/+3
| | | |
| * | | Fix success statusKamil Trzcinski2016-12-072-2/+3
| | | |
| * | | Added Ci::Stage specsKamil Trzcinski2016-12-061-0/+4
| | | |
| * | | Fix handling of allowed to failure jobsKamil Trzcinski2016-12-063-8/+4
| | | |
| * | | Fix handling of skipped vs success statusKamil Trzcinski2016-12-061-3/+3
| | | |
| * | | Fix test failuresKamil Trzcinski2016-12-061-3/+3
| | | |
| * | | Added Stage testsKamil Trzcinski2016-12-061-0/+4
| | | |
| * | | Add Ci::Status::StageKamil Trzcinski2016-12-061-0/+2
| | | |
| * | | Preserve stage values and use StaticModelKamil Trzcinski2016-12-061-5/+11
| | | |
| * | | Introduce `Ci::Stage`, right now this is artificial object that is build ↵Kamil Trzcinski2016-12-063-24/+32
| | | | | | | | | | | | | | | | dynamically.
| * | | Fix broken pipeline rendering [ci skip]Kamil Trzcinski2016-12-061-4/+6
| | | |
| * | | Support pipelines APIKamil Trzcinski2016-12-062-15/+25
| | | | | | | | | | | | | | | | Pass `updated_at` to get only incremental changes since last update
* | | | Merge branch '25209-improve-length-validators' into 'master' Rémy Coutable2016-12-077-19/+31
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | Use :maximum instead of :within for length validators with a 0..N range Closes #25209 See merge request !7894
| * | | Use :maximum instead of :within for length validators with a 0..N range25209-improve-length-validatorsRémy Coutable2016-12-067-19/+31
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | Merge branch 'remove-has-visible-content-caching' into 'master' Douwe Maan2016-12-071-13/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove caching of Repository#has_visible_content? This MR removes the caching of `Repository#has_visible_content?`. The cache for this method is no longer necessary and this should solve the problem described in https://gitlab.com/gitlab-org/gitlab-ce/issues/25278. See merge request !7947
| * | | | Remove caching of Repository#has_visible_content?remove-has-visible-content-cachingYorick Peterse2016-12-061-13/+1
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | This method already uses the cached method Repository#branch_count so there's no point in also caching has_visible_content?. Fixes gitlab-org/gitlab-ce#25278
* | | | Merge branch '23589-open-issue-for-mr' into 'master' Sean McGivern2016-12-063-1/+13
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | Create an issue for all unresolved discussions in an MR See merge request !7180
| * | | Feature: delegate all open discussions to IssueBob Van Landuyt2016-12-053-1/+13
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'refine-ci-statuses' into 'master' Kamil Trzciński2016-12-061-0/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refine CI Statuses ## What does this MR do? This MR introduces classes for each relevant CI status. ## What are the relevant issue numbers? Closes #24273 See merge request !7889
| * | | Expose pipeline detailed status using status factoryGrzegorz Bizon2016-12-051-0/+4
| | |/ | |/|
* | | Merge branch 'glm-shorthand-reference' into 'master' Sean McGivern2016-12-069-64/+69
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | GLM shorthand reference for projects from the same namespace Closes #21679 See merge request !7255
| * | | Add shorthand support to gitlab markdown referencesOswaldo Ferreira2016-12-029-64/+69
| |/ /
* | | Authorize users into imported GitLab projectfix/authorize-users-into-imported-gitlab-projectAhmad Sherif2016-12-051-0/+1
| |/ |/|
* | Merge branch '24921-hide-prompt-to-add-ssh-key-if-ssh-protocol-is-disabled' ↵Sean McGivern2016-12-031-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | into 'master' If SSH prototol is disabled don't say the user requires SSH keys Closes #24921 See merge request !7840
| * If SSH prototol is disabled don't say the user requires SSH keysAndrew Smith2016-12-011-1/+1
| |
* | Merge branch 'process-commit-worker-improvements' into 'master' Douwe Maan2016-12-021-0/+4
|\ \ | | | | | | | | | | | | | | | | | | Pass commit data to ProcessCommitWorker This changes `ProcessCommitWorker` so that it takes a Hash containing commit data instead of a commit SHA. This means the worker doesn't have to access Git just to process a commit message (and other data it may use). This in turn should solve the problem of ending up with 15 000-something jobs in the `process_commit` queue that take forever to process. See merge request !7744
| * | Pass commit data to ProcessCommitWorkerprocess-commit-worker-improvementsYorick Peterse2016-12-011-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | By passing commit data to this worker we remove the need for querying the Git repository for every job. This in turn reduces the time spent processing each job. The migration included migrates jobs from the old format to the new format. For this to work properly it requires downtime as otherwise workers may start producing errors until they're using a newer version of the worker code.
* | Merge branch 'use-st-commits-where-possible' into 'master' Yorick Peterse2016-12-013-12/+17
|\ \ | |/ |/| | | | | Replace references to MergeRequestDiff#commits with st_commits when we care only about the number of commits See merge request !7668
| * Replace references to MergeRequestDiff#commits with st_commitsuse-st-commits-where-possibleAdam Niedzielski2016-12-013-12/+17
| | | | | | | | | | | | when we care only about the number of commits We do not have to instantiate all objects in this case.
* | Refactor JiraService by moving code out of JiraService#execute methodclean-up-jira-serviceAdam Niedzielski2016-12-011-28/+29
|/ | | | | | | | | | The implicit interface of project services states that the "execute" method is meant to be called when project hooks are executed. Currently JiraService does not support any project events even though JiraService#supported_events says that "commit" and "merge_request" are supported. They are only used to render correct options in JIRA configuration screen, but they are not supported. Because of that, this commit makes "execute" method a no-op.
* Merge branch 'fix/rename-merge-request-head-pipeline' into 'master' Kamil Trzciński2016-11-302-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename `MergeRequest#pipeline` to `head_pipeline` ## What does this MR do? This MR renames `MergeRequest#pipeline` to `MergeRequest#head_pipeline` ## Does this MR meet the acceptance criteria? - [x] All builds are passing ## What are the relevant issue numbers? Closes #24810 See merge request !7783
| * Rename `MergeRequest#pipeline` to `head_pipeline`fix/rename-merge-request-head-pipelineGrzegorz Bizon2016-11-292-4/+4
| |
* | Merge branch 'ee-1137-follow-up-protected-branch-users-and-groups' into ↵Douwe Maan2016-11-303-14/+10
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | 'master' CE-specific changes for gitlab-org/gitlab-ee#1137 ## What does this MR do? - gitlab-org/gitlab-ee#1137 is a `technical debt` issue to clean up the EE protected branch access levels (for users and groups) implementation. - Some of this cleanup bleeds over to code shared by CE and EE, which is why this MR is required. - An EE-specific MR has also been created: gitlab-org/gitlab-ee!927 See merge request !7821
| * CE-specific changes gitlab-org/gitlab-ee#1137ee-1137-follow-up-protected-branch-users-and-groupsTimothy Andrew2016-11-293-14/+10
| | | | | | | | | | | | | | - Extract all common {push,merge} access level model code into the `ProtectedBranchAccess` module - Use the HTTP verb to define controller specs
* | Merge branch 'hoopes/gitlab-ce-21027-add-diff-hunks-to-notification-emails' ↵Douwe Maan2016-11-291-3/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into 'master' Add diff hunks to notification emails Add diff hunks to notification emails. Continued from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5855 - thanks @hoopes! This also fixes an issue where the + / - prefixes were missing from diffs in emails. Screenshots (from my browser) of the HTML emails, along with text screenshots :stuck_out_tongue: ![image](/uploads/cb31400becf5149d40c8bb98a655aa93/image.png) ``` New comment for Merge Request !1 on app/views/admin/builds/index.html.haml: http://localhost:3000/gitlab-org/gitlab-ce/merge_requests/1#note_1023 > Finished This is a comment at the top of a match section. ``` ![image](/uploads/704dd3845797530697a27f5c1953c053/image.png) ``` New comment for Merge Request !1 on app/views/admin/builds/index.html.haml: http://localhost:3000/gitlab-org/gitlab-ce/merge_requests/1#note_1022 > Finished > %span.badge.js-running-count= @all_builds.finished.count(:id) > > - %li{class: ('active' if @scope == 'all')} > - = link_to admin_builds_path(scope: :all) do > - All > - %span.badge.js-totalbuilds-count= @all_builds.count(:id) > - > .gray-content-block > #{(@scope || 'running').capitalize} builds > This is a comment at the bottom of a match section. ``` ![image](/uploads/4063f3d9738aea8ebf3c0e690d0eddee/image.png) ``` New comment for Merge Request !1 on app/views/admin/builds/index.html.haml: http://localhost:3000/gitlab-org/gitlab-ce/merge_requests/1#note_1024 > = link_to 'Cancel all', cancel_all_admin_builds_path, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post > > %ul.center-top-menu > - %li{class: ('active' if @scope.nil?)} > + %li{class: ('active' if @scope == 'all')} > = link_to admin_builds_path do > + All This is a comment with some deleted and added lines above it. ``` Closes #21027, closes #24340. See merge request !7660
| * | Tidy up text emailsSean McGivern2016-11-281-2/+5
| | |
| * | Add keyword arguments to truncated_diff methodhhoopes2016-11-251-3/+4
| | | | | | | | | | | | | | | * Added keyword arguments to truncated_diff_lines method to allow for using highlighting or not (html templates vs. text) * Tweaked templates for consistency and format appropriateness
| * | Change diff highlight/truncate for reusabilityhhoopes2016-11-251-5/+7
| | | | | | | | | | | | | | | | | | Previously the `truncated_diff_lines` method for outputting a discussion diff took in already highlighted lines, which meant it wasn't reuseable for truncating ANY lines. In the way it was used, it also meant that for any email truncation, the whole diff was being highlighted before being truncated, meaning wasted time highlighting lines that wouldn't even be used (granted, they were being memoized, so perhaps this wasn't that great of an issue). I refactored truncation away from highlighting, in order to truncate formatted diffs for text templates in email, using `>`s to designate each line, but otherwise retaining the parsing already done to create `diff_lines`. Additionally, while notes on merge requests or commits had already been tested, there was no existing test for notes on a diff on an MR or commit. Added mailer tests for such, and a unit test for truncating diff lines.
* | | Merge branch 'jej-use-issuable-finder-instead-of-access-check' into 'security' Douwe Maan2016-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace issue access checks with use of IssuableFinder Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867 ## Which fixes are in this MR? :warning: - Potentially untested :bomb: - No test coverage :traffic_light: - Test coverage of some sort exists (a test failed when error raised) :vertical_traffic_light: - Test coverage of return value (a test failed when nil used) :white_check_mark: - Permissions check tested ### Issue lookup with access check Using `visible_to_user` likely makes these security issues too. See [Code smells](#code-smells). - [x] :vertical_traffic_light: app/finders/notes_finder.rb:15 [`visible_to_user`] - [x] :traffic_light: app/views/layouts/nav/_project.html.haml:73 [`visible_to_user`] [`.count`] - [x] :white_check_mark: app/services/merge_requests/build_service.rb:84 [`issue.try(:confidential?)`] - [x] :white_check_mark: lib/api/issues.rb:112 [`visible_to_user`] - CHANGELOG: Prevented API returning issues set to 'Only team members' to everyone - [x] :white_check_mark: lib/api/helpers.rb:126 [`can?(current_user, :read_issue, issue)`] Maybe here too? - [x] :white_check_mark: lib/gitlab/search_results.rb:53 [`visible_to_user`] ### Previous discussions - [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b2ff264eddf9819d7693c14ae213d941494fe2b3_128_126 - [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#7b6375270d22f880bdcb085e47b519b426a5c6c7_87_87 See merge request !2031
* | | Merge branch 'jej-fix-missing-access-check-on-issues' into 'security'Douwe Maan2016-11-282-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix missing access checks on issue lookup using IssuableFinder Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867 :warning: - Potentially untested :bomb: - No test coverage :traffic_light: - Test coverage of some sort exists (a test failed when error raised) :vertical_traffic_light: - Test coverage of return value (a test failed when nil used) :white_check_mark: - Permissions check tested - [x] :white_check_mark: app/controllers/projects/branches_controller.rb:39 - `before_action :authorize_push_code!` helpes limit/prevent exploitation. Always checks for reporter access so fine with confidential issues, issues only visible to team, etc. - [x] :traffic_light: app/models/cycle_analytics/summary.rb:9 [`.count`] - [x] :white_check_mark: app/controllers/projects/todos_controller.rb:19 - [x] Potential double render in app/controllers/projects/todos_controller.rb - https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#cedccb227af9bfdf88802767cb58d43c2b977439_24_24 See merge request !2030