Commit Graph
5404 Commits
Author SHA1 Message Date
Sean McGivern f680eca912 Don't allow merges with new commits
Set a `sha` parameter on the MR form. If this doesn't match the HEAD of
the source branch when the form is submitted, show a warning (like with
a merge conflict) and don't merge the branch.
2016-06-01 20:34:41 +01:00
Sean McGivern d863d86aeb Add sha parameter to MR accept API
The `sha` parameter is optional, and when present, must match the
current HEAD SHA of the source branch. Otherwise, the API call fails
with a 409 Conflict and a message containing the current HEAD for the
source branch.

Also tidy up some doc wording.
2016-06-01 20:29:54 +01:00
Stan Hu 30aa64202b Fix note validation spec failures 2016-06-01 10:31:46 -07:00
Douwe Maan 2d084dd848 Merge branch 'separate-banzai-references' into 'master'
Separate reference gathering from rendering

This is a required step to allow batch processing when gathering references. This in turn would allow grabbing (for example) all mentioned users of an issue/merge request using a single query.

cc @rspeicher @DouweM 

See merge request !3969
2016-06-01 15:51:59 +00:00
Yorick Peterse 580d250166 Refactor Participable
There are several changes to this module:

1. The use of an explicit stack in Participable#participants
2. Proc behaviour has been changed
3. Batch permissions checking

== Explicit Stack

Participable#participants no longer uses recursion to process "self" and
all child objects, instead it uses an Array and processes objects in
breadth-first order. This allows us to for example create a single
Gitlab::ReferenceExtractor instance and pass this to any Procs. Re-using
a ReferenceExtractor removes the need for running potentially many SQL
queries every time a Proc is called on a new object.

== Proc Behaviour Changed

Previously a Proc in Participable was expected to return an Array of
User instances. This has been changed and instead it's now expected that
a Proc modifies the Gitlab::ReferenceExtractor passed to it. The return
value of the Proc is ignored.

== Permissions Checking

The method Participable#participants uses
Ability.users_that_can_read_project to check if the returned users have
access to the project of "self" _without_ running multiple SQL queries
for every user.
2016-06-01 16:22:35 +02:00
Douwe Maan ef6fe42ec0 Merge branch 'fix-cancelable-retryable' into 'master'
Fix cancelability and retriablity of pipeline with generic statuses

Currently it's not possible to cancel or retry generic status since this is external thing to GitLab.

This fixes shown actions of pipelines containing only these actions.


See merge request !4380
2016-06-01 14:21:03 +00:00
Rémy Coutable 4581e71c44 Merge branch 'fix/error-500-in-pipeline-when-fork' into 'master'
Use project that belongs to pipeline in view

## What does this MR do?

This MR makes project in pipelines view match the one that pipeline has been created for.

Closes #17943 

See merge request !4376
2016-06-01 12:37:51 +00:00
Douwe Maan d1c537ad32 Merge branch 'long.polyglot/gitlab-ce-issue_17479_todos_not_remove_when_leave_project' 2016-06-01 13:39:56 +02:00
Kamil Trzcinski 57992f3d03 Fix rubocop offenses 2016-06-01 13:10:00 +02:00
Douwe Maan 3416bc53fb Merge branch 'rs-remember-me-2fa' into 'master'
Pass the "Remember me" value to the 2FA token form

Prior, if a user had 2FA enabled and checked the "Remember me" field,
the setting was ignored because the OTP input was on a new form and the
value was never passed.

Closes #18000

See merge request !4369
2016-06-01 10:57:05 +00:00
Douwe Maan 4a50e1f051 Merge branch 'current-settings-use-request-store-during-request' 2016-06-01 12:55:00 +02:00
Douwe Maan c0f19cc94e Merge branch 'fix-404-labels-in-todos' into 'master'
Fix 404 page when viewing TODOs that contain milestones or labels in different projects

A user viewing the TODOs page will see a 404 if there are mentioned milestones or labels in multiple different projects. This is likely a caching bug and only occurs
when Markdown rendering occurs across multiple projects, which is why it's so tricky to reproduce. This is what I think is happening:
    
1. LabelReferenceFilter#references_in encounters label ~X for ProjectA and finds the label in the DB as id = 1.
2. LabelReferenceFilter.references_in yields [1, 'X', nil, ...]
3. Since project_ref is nil, AbstractReferenceFilter#project_from_ref_cache caches nil => ProjectA.
4. LabelReferenceFilter#references_in encounters label ~Y for ProjectB and finds the label in the DB as id = 2.
5. LabelReferenceFilter.references_in yields [2, 'Y', nil, ...]
6. AbstractReferenceFilter#project_from_ref_cache lookups nil and returns ProjectA. It was supposed to be ProjectB.
7. A is the wrong project, so the label lookup fails.
   
This MR expands the `project_ref` to the right value as soon as we have it to avoid this caching bug.
    
Closes #17898


See merge request !4312
2016-06-01 10:50:03 +00:00
Grzegorz Bizon 02cddaea6f Add feature specs for pipeline in MR from fork 2016-06-01 11:57:22 +02:00
Grzegorz Bizon 24c0f0d671 Add feature test for accessing MR created from fork 2016-06-01 11:57:22 +02:00
Rémy Coutable 46ac3107a4 Merge branch 'issue_15557' into 'master'
Fix error 500 when sorting issues by milestone due date and filtering by labels

fixes #15557 

See merge request !4327
2016-06-01 08:42:36 +00:00
Dmitriy Zaporozhets cb261abee1 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2016-06-01 11:34:45 +03:00
Stan Hu f8a3344d12 Fix 404 page when viewing TODOs that contain milestones or labels in different projects
A user viewing the TODOs page will see a 404 if there are mentioned labels
in multiple different projects. This is likely a caching bug and only occurs
when Markdown rendering occurs across multiple projects, which is why it's so
tricky to reproduce. This is what I think is happening:

1. LabelReferenceFilter#references_in encounters label ~X for ProjectA and finds the label in the DB as id = 1.
2. LabelReferenceFilter.references_in yields [1, 'X', nil, ...]
3. Since project_ref is nil, AbstractReferenceFilter#project_from_ref_cache caches nil => ProjectA.
4. LabelReferenceFilter#references_in encounters label ~Y for ProjectB and finds the label in the DB as id = 2.
5. LabelReferenceFilter.references_in yields [2, 'Y', nil, ...]
6. AbstractReferenceFilter#project_from_ref_cache lookups nil and returns ProjectA. It was supposed to be ProjectB.
7. A is the wrong project, so the label lookup fails.

This MR caches Markdown references if the key is present.

Closes #17898
2016-05-31 20:37:53 -07:00
Felipe Artur 56f3b243ce Add leading comment space cop 2016-05-31 19:33:46 -03:00
Robert Speicher 613bcdc626 Merge branch 'data_leak' into 'master'
Confidential notes data leak

Fixes part of https://gitlab.com/gitlab-org/gitlab-ee/issues/575

See merge request !1967
2016-05-31 19:35:13 +00:00
Robert Speicher 4ec1b65bea Merge branch 'refactoring/improve-build-specs' into 'master'
Remove redundant factory namespace in build specs

Extracted from !4351.

See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4351#note_12154604

See merge request !4373
2016-05-31 18:48:27 +00:00
Valery Sizov 9154586ce5 Confidential notes data leak 2016-05-31 21:32:53 +03:00
Rémy Coutable c12c77eb25 Merge branch 'feature/improve_wiki_page_events' into 'master'
Include Wiki attributes in Wiki page events webhook

The hook data we are sending is not 100% correct (we send details of the project, but should also send details of the "ProjectWiki" attributes like URLs and repositories relative to the wiki itself).

This is a follow up to #17506

Fixes #17507

See merge request !4138
2016-05-31 18:10:23 +00:00
Gabriel Mazetto aaaed331ba Fix hook data for Wiki Page event
Added "wiki" section and removed "repository"
2016-05-31 11:24:58 -03:00
Kamil Trzcinski f27daddfc6 Fix rubocop offenses 2016-05-31 15:38:42 +02:00
Felipe Artur 30e61ed79c Fix error 500 when sorting issues by milestone due date and filtering by labels 2016-05-31 10:35:57 -03:00
Kamil Trzcinski 99708dcede Test cancelability and retriablity of pipeline for generic statuses 2016-05-31 15:32:03 +02:00
Kamil Trzcinski 7a6ba30d9a Test token expirability 2016-05-31 13:48:21 +02:00
Grzegorz Bizon 2f1a229d15 Remove redundant factory namespace in build specs
Conflicts:
	spec/models/build_spec.rb
2016-05-31 10:03:39 +02:00
Stan Hu 9951243bf4 Merge branch 'make-container-registry-authentication-service-compatible-with-older-docker' into 'master'
Make authentication service for Container Registry to be compatible with < Docker 1.11

This removes the usage of `offline_token` which is only present when using `Docker 1.11.x` instead we relay on `scope`. This should make it compatible with any client starting from 1.6 (I did test only 1.8 and up).

Right now we return 403 if unauthorized user doesn't have access to anything. In all other cases we return token, but with empty `access`, which simply disallow requested action.



See merge request !4363
2016-05-31 03:18:33 +00:00
Robert Speicher a602df3031 Pass the "Remember me" value to the 2FA token form
Prior, if a user had 2FA enabled and checked the "Remember me" field,
the setting was ignored because the OTP input was on a new form and the
value was never passed.

Closes #18000
2016-05-30 22:25:35 -04:00
Robert Speicher b05981f019 Merge branch 'rubocop/enable-performance-times-map-cop' into 'master'
Enable Performance/TimesMap Rubocop cop

Use Array.new with a block instead of `.times.collect` / `.times.map`.

See #17478

See merge request !4357
2016-05-30 18:06:56 +00:00
Long Nguyen 41f8e6a4d7 Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into issue_17479_todos_not_remove_when_leave_project 2016-05-30 22:24:43 +07:00
Kamil Trzcinski 7ec1fa212d Make authentication service for Container Registry to be compatible with < Docker 1.11 2016-05-30 16:57:39 +02:00
Grzegorz Bizon c370dce01c Enable Style/RedundantParentheses rubocop cop
See #17478
2016-05-30 15:07:18 +02:00
Grzegorz Bizon 0c6f04427b Enable Performance/TimesMap Rubocop cop
Use Array.new with a block instead of `.times.collect` / `.times.map`.

See #17478
2016-05-30 14:21:26 +02:00
Robert Speicher f36e7ff2f9 Shut up, RuboCop
❤️
2016-05-29 23:12:19 -04:00
Grzegorz BizonandRobert Speicher dbba60029c Improve note factory 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher cc2efcf1a6 Improve notes factory 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher fc57d36018 Minor changes in note validation specs 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher e558edd1ce Update specs to carry out changes in note factory 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 21d0cddd45 Do not override foreign attributes in note factory 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 0e613db76d Add more validation tests for note model 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher bf0b51d252 Update note factory to include noteable association 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 1bcb1ef85e Update specs for creating new note without access 2016-05-29 15:03:00 -04:00
Zeger-Jan van de WegandStan Hu be613de2cf Project#show on projects pending deletion will 404
fixes #17508
2016-05-28 03:14:43 -07:00
DJ Mountney 7d57b11093 Update tests for the current_application_settings request store changes 2016-05-27 19:05:52 -07:00
Jacob Schatz 61072a0244 Merge branch 'fix-shortcuts-spec' into 'master'
Ensure project name is present on page

## What does this MR do?
Fixes a failing spec




See merge request !4307
2016-05-27 01:39:46 +00:00
Jacob Schatz 29db3f2c52 Merge branch 'filter-by-any-user' into 'master'
Filter issuables by any user

![any-user](/uploads/c9626b9ac355747344a7073f61dc0c82/any-user.gif)

Closes #2836

See merge request !3820
2016-05-26 22:00:22 +00:00
Robert Speicher 1087b26bf2 Remove boilerplate spec file for Ci::RunnerProject
[ci skip]
2016-05-26 17:52:43 -04:00
Alfredo Sumaran bb3111c116 Ensure project name is present on page 2016-05-26 16:11:58 -05:00