Commit Graph
177 Commits
Author SHA1 Message Date
Dmitriy Zaporozhets f40b99d02e Merge branch 'master' into rubocop-for-tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	spec/features/issues_spec.rb
	spec/models/forked_project_link_spec.rb
	spec/models/hooks/service_hook_spec.rb
	spec/models/hooks/web_hook_spec.rb
	spec/models/project_services/hipchat_service_spec.rb
	spec/requests/api/project_members_spec.rb
	spec/requests/api/projects_spec.rb
	spec/requests/api/system_hooks_spec.rb
	spec/services/archive_repository_service_spec.rb
	spec/support/matchers.rb
	spec/tasks/gitlab/backup_rake_spec.rb
2015-06-23 10:44:03 +02:00
Stan Hu 52aa21b12d Fix Style/IndentationWidth cop violations 2015-06-22 22:25:40 -07:00
Stan Hu 359ed48638 Fix Style/AlignHash cop violations 2015-06-22 22:24:39 -07:00
Robert Speicher 15a05be70d Fix Style/Blocks cop violations 2015-06-22 16:00:54 -04:00
Robert Speicher 56246b70fb Fix Style/TrailingBlankLines cop violations 2015-06-22 14:38:33 -04:00
Robert Speicher 649c9969ba Fix Style/IndentationConsistency cop violations 2015-06-22 14:33:01 -04:00
Dmitriy Zaporozhets cf259cdb43 Remove unnecessary whitespace between let and (
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-22 14:39:07 +02:00
Robert SpeicherandDmitriy Zaporozhets 0f627f1c60 Fix raise_error without an argument deprecation warnings 2015-06-22 12:13:47 +02:00
Robert SpeicherandDmitriy Zaporozhets 7460c39f60 Fix GitPushService spec 2015-06-22 12:13:47 +02:00
Robert SpeicherandDmitriy Zaporozhets 2120e2dd95 Replace remaining references to Note.create_cross_reference_note 2015-06-22 12:13:46 +02:00
Robert SpeicherandDmitriy Zaporozhets 5a9ede4721 Update mock and stub syntax for specs 2015-06-22 12:13:46 +02:00
Douwe Maan 903132bc07 Merge branch 'fix-ext-issue-webbased-hooks' into 'master'
Fix hooks for web based events with external issue references

The creation of cross references for external issues (which would fail)
is now prevented. This fixes a 500 error and the execution of hooks when
creating a merge request or commenting on one.

Fixes #1650, GH-9333.

This regression might have been introduced by
8f8a8ab32b. There is actually a TODO by
@rspeicher mentioning external issues which is lost (unhandled) in a
later commit.

This fix is related to !766 and !804 which fix a similar issue for hooks for
Git based events.

See merge request !794
2015-06-16 11:36:31 +00:00
Douwe Maan 6617e9bbf3 Merge branch 'fix-post-receive-external-tracker' into 'master'
Fix post-receive errors on a push when an external issue tracker is configured

### What does this MR do?

This MR improves upon !766, fixing errors upon a git push that occur only when an external issue tracker (not JIRA) is used. This MR takes into account that external issue trackers, such as JIRA, may close issues. Disabling the processing of post-receive commits when an external issue tracker is configured seems like the wrong behavior.

### Why was this MR needed?

When a user adds an issue reference, the refactoring in 8f8a8ab and a6defd157 caused `project.get_issue` to be called, causing `ExternalIssue` to be returned when an external issue tracker was configured. This object does not have a `close` method, as needed in `CloseService`. Nor does it make sense to associate a `SystemNote` with this object.

GitLab EE uses a [special case for JIRA](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/app/services/git_push_service.rb#L87). I would recommend moving this logic into `CloseService` too.

### What are the relevant issue numbers?

* Closes #1700
* Closes #1720

See merge request !804
2015-06-15 07:42:24 +00:00
Daniel Gerhardt 92bb845e1e Fix hooks for web based events with external issue references
The creation of cross references for external issues (which would fail)
is now prevented.

Fixes #1650, GH-9333.
2015-06-14 17:41:11 +02:00
Robert Speicher 422236c71e Change foo.should syntax to expect(foo).to in specs 2015-06-13 18:37:30 -04:00
Robert Speicher 75a40ad5bc Change foo.should_not syntax to expect(foo).not_to in specs 2015-06-13 18:19:24 -04:00
Stan Hu d45112258e Fix post-receive errors on a push when an external issue tracker is configured
Closes #1700
Closes #1720
2015-06-12 06:59:27 -07:00
Dmitriy Zaporozhets 53a0ac4734 Skip repo removing whem remove user or group
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-03 16:16:27 +02:00
Dmitriy Zaporozhets fd1723f0fc Add tests for project destroy service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-03 13:08:17 +02:00
Stan Hu 5e4384ec9b Support editing target branch of merge request
Closes https://github.com/gitlabhq/gitlabhq/issues/7105
See: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/130
2015-05-29 04:08:08 -07:00
Dmitriy Zaporozhets 701c2e9a3b Merge branch 'rs-to_reference' into 'master'
Add to_reference method to referable models

Now there is a single source of information for which attribute a model uses to be referenced, and its special character.

See merge request !641
2015-05-27 10:03:14 +00:00
Robert Speicher 38637e7d08 Change one-character variable name
[ci skip]
2015-05-27 03:34:14 -04:00
Robert Speicher 1aa3921dd8 Add a note when an Issue or Merge Request's title changes 2015-05-26 21:49:04 -04:00
Robert Speicher 5a9c5520d9 Make use of to_reference in more specs 2015-05-26 15:49:22 -04:00
Stan Hu deeff56967 Add support for Webhook note events
Closes https://github.com/gitlabhq/gitlabhq/issues/6745
2015-05-21 23:48:16 -04:00
Douwe Maan 5210778d6e Fix specs. 2015-05-15 15:38:05 +02:00
Arthur Gautier a927bf56b1 Call merge request web hook for each commits
Call merge request web hook every times a new commit hits the
source branch

Signed-off-by: Arthur Gautier <baloo@gandi.net>
2015-05-13 09:33:20 +02:00
Robert Speicher 54db527b4c Reorganize SystemNoteService spec a bit 2015-05-11 00:01:16 -04:00
Robert Speicher 8390427583 Spec SystemNoteService.cross_reference_disallowed? 2015-05-11 00:01:16 -04:00
Robert Speicher 686f6855c2 Update SystemNoteService method naming conventions
Now the verb comes first, and there is no restriction on
singular/plural.
2015-05-11 00:01:15 -04:00
Robert Speicher ff3a62aad1 Remove legacy special case for emphasized reference notes 2015-05-11 00:01:15 -04:00
Robert Speicher 48e6fb532a Add a SystemNoteService class
There's a lot of code in the Note model that only deals with creating
system notes, so we're going to split that into its own class.
2015-05-11 00:01:01 -04:00
Stan Hu 03138a3c72 Make the first branch pushed to an empty repository the default HEAD.
In an empty repository, pushing a new branch not called "master" would
leave HEAD in an unknown state, causing ambiguity if another branch
were pushed. This could in turn cause a new protected branch to be
created and cause the default branch to change.

* Closes #1561
* Closes #1576
* Closes https://github.com/gitlabhq/gitlabhq/issues/8883
2015-05-05 23:49:30 -07:00
Douwe Maan 0cf76a0b70 Use Projects::CreateService to fork projects so that after-create hooks are run. 2015-04-24 22:58:27 +02:00
Douwe Maan 0ff778c0f4 Link cross-project cross-reference notes to correct project. 2015-04-24 12:30:36 +02:00
Douwe Maan 8ed7ac9d44 Use project.commit convenience method. 2015-04-24 12:29:36 +02:00
Douwe Maan 990b476faa Fix notification service spec. 2015-04-15 21:09:14 +02:00
Douwe Maan 959ebbcade Clean up code around commit mentions. 2015-04-15 17:57:31 +02:00
Dmitriy Zaporozhets 1ff40a7946 Merge branch 'ci_fork' into 'master'
Project fork on CI side

https://dev.gitlab.org/gitlab/gitlab-ci/issues/187

!!! GitLab CI side MR - https://gitlab.com/gitlab-org/gitlab-ci/merge_requests/56

See merge request !499
2015-04-09 13:41:37 +00:00
Valery Sizov bafec400f1 CI forking: tests 2015-04-06 19:45:16 +03:00
Douwe Maan 317206300d Merge branch 'configurable-attachment-size' into 'master'
Support configurable attachment size in Application Settings page

### What does this MR do?

This MR provides the ability to configure the maximum size of an attachment inside a note. A parameter has been added to the Application Settings page.

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

What should be done with the legacy note attachment validation? I added code to make the validation work with the configurable setting. I could see an issue where an admin lowers the limit from 10 megabytes to 5 megabytes, which could cause an existing model to be invalid.

### Why was this MR needed?

We often have attachments that exceed 10 MB, and it would be nice to be able to override the defaults.

### What are the relevant issue numbers / [Feature requests](http://feedback.gitlab.com/)?

See Issue #1258

### Screenshots

Before:

![Screen_Shot_2015-03-29_at_3.06.53_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/6013a1dbc8cf61a63e93744149937fa0/Screen_Shot_2015-03-29_at_3.06.53_PM.png)

After:

![Screen_Shot_2015-03-29_at_3.12.34_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/f3518af7e8653ba40f0a3579456da6ad/Screen_Shot_2015-03-29_at_3.12.34_PM.png)

See merge request !407
2015-04-03 08:47:55 +00:00
Stan Hu dfd256f29e Support configurable attachment size via Application Settings
Fix bug where error messages from Dropzone would not be displayed on the issues page

Closes #1258
2015-04-02 00:04:08 -07:00
Douwe Maan 91761b0685 Add tests. 2015-03-31 13:37:21 +02:00
Kamil Trzcinski 5b432e7671 Extend push_tag event to include tag message and last commit 2015-03-21 11:25:27 +01:00
Dmitriy Zaporozhets 9162e34bb0 Merge branch 'issue_subscription' into 'master'
Subscription to issue/mr

Fixes #1911 and #1909

![joxi_screenshot_1426601822159](https://dev.gitlab.org/gitlab/gitlabhq/uploads/53021bc5783271322ab2dfba7598eaa3/joxi_screenshot_1426601822159.png)

![joxi_screenshot_1426601836423](https://dev.gitlab.org/gitlab/gitlabhq/uploads/244ff360fbd6f30980f8dad699400814/joxi_screenshot_1426601836423.png)

See merge request !1702
2015-03-17 16:45:04 +00:00
Valery Sizov 1b437ec349 tests 2015-03-16 21:38:41 +02:00
Dmitriy Zaporozhets 648f38cd98 Merge branch 'fix-restricted-visibility' into 'master'
Restricted visibility levels - bug fix and new feature

This allows admin users to override restricted visibility settings when creating and updating projects and snippets, and moves the restricted visibility configuration from gitlab.yml to the web UI.  See #1903.

## Move configuration location

I added a new section to the application settings page for restricted visibility levels.  Each level has a checkbox, styled with Bootstrap to look like a toggle button.  A checked box means that the level is restricted.  I added a glowing text shadow and changed the background color for checked buttons because the default styles made it hard to distinguish between checked and unchecked.  This image shows the new section with the "Public" box checked:

![restricted_visibility_settings](https://dev.gitlab.org/Okada/gitlabhq/uploads/629562e4313f89b795e81c3bb0f95893/restricted_visibility_settings.png)

## Allow admins to override

To allow admin users to override the restricted visibility levels, I had to remove the `visibility_level` validation from the `Project` class.  The model doesn't know about the `current_user`, which should determine whether the restrictions can be overridden.  We could use the creator in the validation, but that wouldn't work correctly for projects where a non-admin user is the creator and an admin tries to change the project to a restricted visibility level.

The `Project::UpdateService` and `Project::CreateService` classes already had code to determine whether the current user is allowed to use a given visibility level; now all visibility level validation is done in those classes.  Currently, when a non-admin tries to create or update a project using a restricted level, these classes silently set the visibility level to the global default (create) or the project's existing value (update).  I changed this behavior to be more like an Active Model validation, where using a restricted level causes the entire request to be rejected.

Project and personal snippets didn't have service classes, and restricted visibility levels weren't being enforced in the model or the controllers.  The UI disabled radio buttons for restricted levels, but that wouldn't be difficult to circumvent.  I created the `CreateSnippetService` and `UpdateSnippetService` classes to do the same restricted visibility check that the project classes do.  And since I was dealing with snippet visibility levels, I updated the API endpoints for project snippets to allow users to set and update the visibility level.

## TODO

* [x] Add more tests for restricted visibility functionality

cc @sytse @dzaporozhets

See merge request !1655
2015-03-16 17:49:46 +00:00
Douwe Maan 99f995755e Use group_member instead of users_group or membership. 2015-03-15 13:49:41 +01:00
Vinnie Okada ad0ca0499a Merge branch 'master' into fix-restricted-visibility
Conflicts:
	db/schema.rb
2015-03-14 10:49:11 -06:00
Vinnie Okada 13e9f4f334 Add tests for snippet services
Add Rspec tests for the new UpdateSnippetService and
CreateSnippetService classes.
2015-03-14 10:33:02 -06:00