Commit Graph

38769 Commits

Author SHA1 Message Date
Sean McGivern f4fed44f67 Merge branch '22392-add-x-of-y-tasks-completed-on-issuable' into 'master'
add "x of y tasks completed" on issuable

Closes #22392

See merge request !6527
2016-10-28 17:55:18 +00:00
Rémy Coutable f60e6d552c Merge branch 'fix-8-13-changelog-gh-import' into 'master'
Fix CHANGELOG for GH import fixes

See merge request !7173
2016-10-28 17:06:50 +00:00
Stan Hu e8ecc1a069 Merge branch 'ee-1159-allow-permission-check-bypass-in-approve-access-request-service' into 'master'
Allow Members::ApproveAccessRequestService to accept a new `:force` option

## What does this MR do?

See the commit message.

This is a backport of the EE fix for https://gitlab.com/gitlab-org/gitlab-ee/issues/1159: gitlab-org/gitlab-ee!830

See merge request !7168
2016-10-28 16:44:35 +00:00
Rémy Coutable 5742f4a628 Merge branch '23872-members-of-group-that-has-project-access-getting-404-on-accessing-a-project-issue' into 'master'
Fix project member access for group links

Closes #23872.

See merge request !7144
2016-10-28 16:33:23 +00: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
Douwe Maan 44cbfeaba8 Merge branch 'adam-fix-labels-find-or-create' into 'master'
Pass user instance to Labels::FindOrCreateService or skip_authorization: true

## What does this MR do?

It fixes a bug described in #23694 when `project.owner` was passed to `Labels::FindOrCreateService`. `Labels::FindOrCreateService` expected a user instance and `project.owner` may return a group as well. This MR makes sure that we either pass a user instance or `skip_authorization: true`.

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

- places where we pass `skip_authorization: true`

## Does this MR meet the acceptance criteria?

- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [ ] 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?

Fixes #23694

See merge request !7093
2016-10-28 15:01:59 +00:00
Stan Hu d306b0d7c2 Merge branch 'use-optimistic-locking' into 'master'
Use optimistic locking

## What does this MR do?
Removes the usage of pessimistic locking in favor of optimistic which is way cheaper and doesn't block database operation.

Since this is very simple change it should be safe. If we receive `StaleObjectError` message we will reload object a retry operations in lock.

However, I still believe that we need this one: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7005 as this will reduce a load on Database and FS.
This changes a behavior from:

### Pesimistic locking (previous behavior)

#### For updating
1. SELECT * FOR UPDATE (other updates wait on this)
2. we update ci_pipeline
3. latest_build_status
4. enqueue: (use: transition :created -> :pending)
5. [state_machine] we are in  state created, we can go to pending
6. [state_machine] ci_pipeline.status = created
7. [state_machine] ci_pipeline.save
8. [state_machine] after_transition: (if for success): PipelineSuccessWorker on Sidekiq
9. release DB lock

#### If no update is required
1. SELECT * FOR UPDATE (other updates wait on this)
2. we update ci_pipeline
3. latest_build_status
4. we are in pending, we can't transition to pending, because it's forbidden
5. release DB lock

### Optimistic locking (implemented by this MR)

#### For updating
1. latest_build_status
2. enqueue: (use `transition :created -> :pending`)
3. [state_machine] we are in state created, we can go to pending
4. [state_machine] ci_pipeline.status = created
5. [state_machine] ci_pipeline.save
6. [state_machine] [save] where(lock_version: ci_pipeline.lock_version).update_all(status: :created, updated_at: Time.now)
7. [state_machine] [save] unless we_updated_row then raise ObjectInconsistentError

#### If no update is required
1. we update ci_pipeline
2. latest_build_status
3. we are in pending, we can't transition to pending, because it's forbidden

## Why was this MR needed?
We have been seeing a number of problems when we migrated Pipeline/Build processing to Sidekiq. Especially we started seeing a lot of blocking queries.

We used a pessimistic locking which doesn't seem to be required. This effectively allows us to fix our issues with blocked queries by using more efficient method of operation.

## What are the relevant issue numbers?
Issues: https://gitlab.com/gitlab-com/infrastructure/issues/623 and https://gitlab.com/gitlab-com/infrastructure/issues/584, but also there's a bunch of Merge Requests that try to improve behavior of scheduled jobs.

cc @pcarranza @yorickpeterse @stanhu

See merge request !7040
2016-10-28 14:41:24 +00:00
Robert Speicher 144358e98e Merge branch 'issue-board-welcome-cookie-monster' into 'master'
Delete issue board welcome cookie

## What does this MR do?

This was seen in the idea to production demo, because the project had already existed on the exact same URL the cookie already existed which meant the blank state wasn't shown. 

This MR deletes the cookie on project create.

See merge request !6899
2016-10-28 14:16:53 +00:00
Sean McGivern af6cf695c4 Add specs for a user from a group link 2016-10-28 15:11:32 +01:00
Rémy Coutable 61e2b88dd1
Allow Members::ApproveAccessRequestService to accept a new :force param
This param allows to bypass permission check. It is useful for LDAP-sync
where even owners don't have the :admin_group_member permission.

See
6081c37123/app/policies/group_policy.rb (L38)
and https://gitlab.com/gitlab-org/gitlab-ee/issues/1159

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-28 15:45:26 +02:00
Rémy Coutable 2672f44e25 Merge branch 'clean-up-issue_spec.js' into 'master'
Replace static fixture by generated one in issue_spec.js

## What does this MR do?

- clean up `issue_spec.js`
- introduce an alternative approach to #19445
  - rename `rake teaspoon` to `rake teaspoon:tests`
  - introduce `rake teaspoon:fixtures` which generates fixtures using RSpec
  - introduce `rake teaspoon` which runs `rake teaspoon:fixtures` and `rake teaspoon:tests`

## Why was this MR needed?

- many duplications
- missing existence checks
- missing conditions
- static fixtures don't match real views

## Reasoning

I want to explain some of my decisions here, so that they stay visible for future discussions.

### Why not HAML?

- same number of HAML templates as number of fixtures (many input files)
- embedded logic less readable
- can not be rendered by JavaScript (because of inline Ruby)

### Why RSpec?

- real controllers for fixtures
- spys available for mocking
- easily report failed fixture generations

### Why not magic_lamp? (#19445)

- introduces another dependency/tool
- needs to run a server concurrently to teaspoon
- makes it harder to use a JavaScript test runner
- static HTML files serve faster

See merge request !6059
2016-10-28 13:37:19 +00:00
Phil Hughes 07e4ffd708 Fixed boards store spec 2016-10-28 13:54:36 +01:00
Phil Hughes a2e9bc3584 Delete issue board welcome cookie when project is new 2016-10-28 13:54:36 +01:00
Sean McGivern d245593138 Fix CHANGELOG for GH import fixes
These changes are targeted for 8.13.2, not 8.14.
2016-10-28 13:48:11 +01:00
Sean McGivern 4fd015183c Merge branch 'fix/make-github-import-retryable' into 'master'
Modify GitHub importer to be retryable

Closes #23533

See merge request !7003
2016-10-28 12:44:32 +00:00
Rémy Coutable 04c7c8d8bb Merge branch '5905-duplicate-email-errors' into 'master'
Only show one error message for an invalid email

Changes it to only validate the notification_email format if it's different from email.

Closes #5905

See merge request !7158
2016-10-28 12:38:00 +00:00
Sean McGivern 8487af81db Merge branch 'bugfix/dragging_milestones' into 'master'
Stop unauthorized users dragging on milestone page

Closes #13670

See merge request !7113
2016-10-28 12:08:30 +00:00
Winnie cd3c8e9b12 Document how to run frontend tests 2016-10-28 14:02:17 +02:00
winniehell 0f060bf4fc Replace static issue fixtures by script (!6059) 2016-10-28 14:02:17 +02:00
winniehell 8afc287330 Clean up issue_spec.js 2016-10-28 14:02:17 +02:00
Rémy Coutable 4370d68f03 Merge branch 'deploykeys-api-doc' into 'master'
Document admin access requirement for /deploy_keys endpoint

Closes #23807

See merge request !7164
2016-10-28 11:51:43 +00:00
Rémy Coutable d6bf691dff Merge branch '23928-sortable-highest_label_priority-is-bugged' into 'master'
Fix and improve `Sortable.highest_label_priority`

Closes #23928

See merge request !7165
2016-10-28 11:50:43 +00:00
Sean McGivern 5c5f34dd13 Merge branch '23890-api-should-accepts-boolean' into 'master'
API: Fix booleans not recognized as such when using the `to_boolean` helper

Fixes #22831
Fixes #23890

See merge request !7149
2016-10-28 11:42:01 +00:00
Sean McGivern 292c982e34 Merge branch 'issue_1008_1' into 'master'
Jira refactoring to jira gem

part of gitlab-org/gitlab-ee#1008

Original MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2572/commits

See merge request !6598
2016-10-28 11:41:20 +00:00
Douwe Maan 8b0cdf4c83 Merge branch '23875-fixup-failing-spec' into 'master'
Prevent a spec from failing in `spec/features/merge_requests/diff_notes_resolve_spec.rb`

## What does this MR do?

Fixes a failing spec in `spec/features/merge_requests/diff_notes_resolve_spec.rb`

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

## Why was this MR needed?

Tests failing on master. RSpec executes inner `before` blocks after outer `before` blocks, so the second note was being added *after* loading the page, and then being pulled in by running JS on the page, causing intermittent failures if we clicked the resolve button before the note was loaded.

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] [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
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [ ] 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 it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

Closes #23875

See merge request !7150
2016-10-28 11:13:20 +00:00
blackst0ne 587ee5fb80 Merge branch 'bugfix/dragging_milestones' of gitlab.com:blackst0ne/gitlab-ce into bugfix/dragging_milestones 2016-10-28 21:46:08 +11:00
blackst0ne 0162c132f4 Stop unauthorized users dragging on milestone page 2016-10-28 21:43:43 +11:00
Adam Niedzielski e2c603696a Pass user instance to Labels::FindOrCreateService or skip_authorization: true
Do not pass project.owner because it may return a group and Labels::FindOrCreateService
throws an error in this case.
Fixes #23694.
2016-10-28 11:31:45 +02:00
blackst0ne ad5894e248 Stop unauthorized users dragging on milestone page 2016-10-28 20:30:58 +11:00
Ahmad Sherif f68d9261b0 Fix typos 2016-10-28 11:30:20 +02:00
Ahmad Sherif 07275dd79c Abstract the use of imported[!?] and {current,increment}_page in GitHub importer 2016-10-28 11:30:20 +02:00
Ahmad Sherif bc6302b942 Use public_send instead of send 2016-10-28 11:30:20 +02:00
Ahmad Sherif 14fbd25d06 Modify GitHub importer to be retryable 2016-10-28 11:30:20 +02:00
Ahmad Sherif 6e590af148 Check if repository already exists before trying to re-import it 2016-10-28 11:12:48 +02:00
Sean McGivern 66870960af Merge branch 'fix/gh-import-bugs' into 'master'
Fix couple of GitHub importing bugs

Fix a bug in GH comment importing and label applying for imported MRs.

See merge request !7139
2016-10-28 08:48:08 +00:00
Sean McGivern db9979bcad Fix project member access for group links
`ProjectTeam#find_member` doesn't take group links into account. It was
used in two places:

1. An admin view - it can stay here.
2. `ProjectTeam#member?`, which is often used to decide if a user has
   access to view something.

This second part broke confidential issues viewing. `IssuesFinder` ends
up delegating to `Project#authorized_for_user?`, which does consider
group links, so users with access to the project via a group link could
see confidential issues on the index page. However, `IssuesPolicy` used
`ProjectTeam#member?`, so the same user couldn't view the issue when
going to it directly.
2016-10-28 09:20:55 +01:00
Alejandro Rodríguez 7bd6ff03d8 Fix and improve `Sortable.highest_label_priority` 2016-10-27 21:26:56 -03:00
Nick Thomas 671556c611 Fix a failing spec in diff_notes_resolve_spec.rb 2016-10-28 00:51:30 +01:00
winniehell 166d5b0dfb Document admin access requirement for /deploy_keys endpoint 2016-10-28 00:56:34 +02:00
Annabel Dunstone Gray 20a7db4483 Merge branch 'modal-mergerequest-shorten-clipboard' into 'master'
edited stylesheet with mr modal fixes and added to changelog

## What does this MR do?
It shortens the modal command merge info elements.

## Are there points in the code the reviewer needs to double check?
I used the `.dark` class.. is that correct usage?
Made no issue as this is a minor upgrade to UI

## Why was this MR needed?
Clipboard buttons could obscure information in the merge info modal, this way its clean.

## Screenshots (if relevant)

From:
![image](/uploads/99269c9a314c593cb06239c27565b07c/image.png)

To:
![image](/uploads/7e278a5aaa8c57270e8a320cc270b5d8/image.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
- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [ ] 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 it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?
None, its a quick fix

See merge request !7145
2016-10-27 22:51:15 +00:00
Sid Sijbrandij 09cccd9345 Merge branch 'link-to-contributing-from-readme' into 'master'
Add section about contributing to README

Closes #23830

See merge request !7137
2016-10-27 22:49:04 +00:00
Dimitrie Hoekstra 8e430807f8 edited stylesheet with mr modal fixes and added to changelog 2016-10-27 16:48:52 -05:00
Steve Halasz af1936def9 Merge branch 'master' into 5905-duplicate-email-errors
Get fix for teaspoon tests
2016-10-27 17:43:25 -04:00
Jacob Schatz 51821e1ee4 Merge branch 'remove-jquery-cookie-from-dashboard-spec' into 'master'
Replaced jquery.cookie with js.cookie

## What does this MR do?

Fixes currently failing `teaspoon` build by replacing the last reference to `jquery.cookie` with `js.cookie`.

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

## Why was this MR needed?

`master` failing.

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] [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
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [ ] 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 it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

See merge request !7160
2016-10-27 21:25:04 +00:00
Luke Bennett 4efaeb5668
Replaced jquery.cookie with js.cookie 2016-10-27 21:33:16 +01:00
Steve Halasz 32e46d3502 Merge branch 'master' into 5905-duplicate-email-errors
Getting latest CHANGELOG so I can resolve merge conflict
2016-10-27 16:07:56 -04:00
Steve Halasz 47bda4f009 Add changelog entry 2016-10-27 16:05:12 -04:00
Steve Halasz 36ec5eaf85 Only show one error message for an invalid email
If notification_email is blank, it's set from email. If an admin
attempted to create a user with an invalid email, an error would be
displayed for both fields. Only validate the notification_email if it's
different from email.
2016-10-27 15:46:28 -04:00
Jacob Schatz 85bd6296a7 Merge branch 'fix-linting' into 'master'
Enable linting for ES6 files

## What does this MR do?

Add `.js.es6` to file extensions checked by ESLint.

## What are the relevant issue numbers?

Follows !5445

See merge request !7156
2016-10-27 19:42:41 +00:00
winniehell 4060807719 Enable linting for ES6 files 2016-10-27 21:35:07 +02:00