Commit Graph
425 Commits
Author SHA1 Message Date
Dmitriy Zaporozhets 342d553709 Rename abilities to correspond contoller/model action names
write_ was renamed to create_
modify_  was renamed to update_

So now in update action we have next code

def create
  can?(current_user, :create_issue, @issue)
end

def update
  can?(current_user, :update_issue, @issue)
end

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:55:56 +02:00
Dmitriy Zaporozhets d5947ada44 Simplify set of assignee, milestone and label to admin_issue rule
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:45:45 +02:00
Dmitriy Zaporozhets 0bcfe9a0dc Dont allow set assignee, milestone or labels if user is guest
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-25 16:17:48 +02:00
Adam Meily 0cf2e62fb2 Updated merge request merged web hook to correctly fire action=merged.
Fixes #879
Fixes #498
2015-06-24 10:15:18 -04:00
Stan Hu e80d7a804f Fix error when deleting a user who has projects
Closes #1856
Closes https://github.com/gitlabhq/gitlabhq/issues/9394
2015-06-23 04:39:49 -07:00
Robert SpeicherandDmitriy Zaporozhets 2120e2dd95 Replace remaining references to Note.create_cross_reference_note 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
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
zenati b0de6e9ae2 An in_namespace scope is already present 2015-06-09 13:42:01 +02:00
Dmitriy Zaporozhets 87f9c475db Merge branch 'refactor-web-editor' into 'master'
Refactor web editor

* fix problem with editing non-master branch
* before commit make sure branch exists
* dont allow user change file in one branch and commit to another existing branch
* remove a lot of code duplication
* remove outdated statellite errors

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Fixes #1761

See merge request !773
2015-06-05 16:14:34 +00:00
Dmitriy Zaporozhets dfccb06dda Refactor web editor
* fix problem with editing non-master branch
* before commit make sure branch exists
* dont allow user change file in one branch and commit to another existing branch
* remove a lot of code duplication
* remove outdated statellite errors

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-05 15:01:38 +02:00
Douwe Maan 4ae67fcaef Show warning when a comment will add 10 or more people to the discussion. 2015-06-05 12:07:13 +02: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 7bab4817f7 Merge branch 'repo-remove' into fix-group-remove
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	spec/features/projects_spec.rb
2015-06-03 15:15:46 +02:00
Dmitriy Zaporozhets 58ab8a4a9d Fix tests and increase delay time before remove repository
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-03 15:09:12 +02:00
Dmitriy Zaporozhets 1edff53444 Remove projects before group/user. Remove namespace directory async
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-03 14:57:12 +02:00
Dmitriy Zaporozhets 61cfd1d273 Wrap group removal into service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-03 14:07:20 +02:00
Dmitriy Zaporozhets 97ff86e07c Move repository when project is removed
Ths commit does next:

* When we remove project we move repository to path+deleted.git
* Then we schedule removal of path+deleted with sidekiq
* If repository move failed we abort project removal

This should help us with NFS issue when project get removed but
repository stayed. The full explanation of problem is below:

* rm -rf project.git
* rm -rf removes project.git/objects/foo
* NFS server renames foo to foo.nfsXXXX because some NFS client (think
* Unicorn) still has the file open
* rm -rf exits, but project.git/objects/foo.nfsXXX still exists
* Unicorn closes the file, the NFS client closes the file (foo), and the
* NFS server removes foo.nfsXXX
* the directory project.git/objects/ still exists => problem

So now we move repository and even if repository removal failed

Repository directory is moved so no bugs with project removed but
repository directory taken. User still able to create new project with
same name. From administrator perspective you can easily find stalled
repositories by searching `*+deleted.git`

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-03 13:05:43 +02:00
Dmitriy Zaporozhets 435f680b89 Make web editor work correctly after switch from satellites
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-02 12:06:40 +02:00
Dmitriy Zaporozhets 8997812626 Remove files in web editor using rugged
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-02 11:41:21 +02:00
Dmitriy Zaporozhets 3d416f1682 Create activity event and execute hooks on web editor commit
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-02 10:45:13 +02:00
Dmitriy Zaporozhets 541133197b Use rugged in web editor for base64 encoding
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-01 23:43:35 +02:00
Dmitriy Zaporozhets 27a158506e Fix adding new file to empty repo
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-01 21:17:13 +02:00
Dmitriy Zaporozhets 734a4ba87d Create and edit files in web editor via rugged
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-01 20:49:11 +02:00
Stan Hu 85145d1d77 Disable changing of the source branch in merge request update API 2015-05-29 09:40:35 -07:00
Dmitriy Zaporozhets a1c45338f3 Merge branch 'support-edit-target-branch-in-mr' into 'master'
Support editing target branch of merge request

### What does this MR do?

This MR makes it possible to edit the target branch of a merge request and adds a system note when this happens.

### Why was this MR needed?

Because lots of people requested this feature. :)

### Screenshots

**Edit MR page**

![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/9b3d405bf7b5f945e35bae3534c2b67b/image.png)

**New MR page**

![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/3657a2a9efad6d10e8470637d1166bdb/image.png)

**System note**

![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/cc8066f3d3bdf09c0cce27193210567d/image.png)

### What are the relevant issue numbers?

* Closes https://github.com/gitlabhq/gitlabhq/issues/7105
* See: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/130!

See merge request !738
2015-05-29 15:01:54 +00: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 499154518a You can not remove user if he/she is an only owner of group
To prevent loose of group data you need to transfer or remove group
first before you can remove user

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-05-28 12:00:02 +02: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 1aa3921dd8 Add a note when an Issue or Merge Request's title changes 2015-05-26 21:49:04 -04:00
Robert Speicher 3cb6a33846 More SystemNoteService cleanup 2015-05-26 16:30:07 -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 6960e83b1e Fix. 2015-05-15 13:54:41 +02:00
Douwe Maan fb86ec519c Move stuff around a bit in NotifictionService. 2015-05-15 12:45:18 +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 3e8efce360 Refactor 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
bugagazavr acac788902 Added X-GitLab-Event header for web hooks 2015-05-08 16:49:03 +03: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
Valery Sizov bc9ba5237c Revert "Added X-GitLab-Event header for web hooks"
This reverts commit 548f182814.
2015-04-27 16:29:31 +03:00
Dmitriy Zaporozhets 278c3ba401 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2015-04-27 11:38:36 +03:00
bugagazavr 548f182814 Added X-GitLab-Event header for web hooks 2015-04-25 21:31:52 +03: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 27af24c1c9 No longer needed to pass project argument to commit methods. 2015-04-24 12:29:36 +02:00
Douwe Maan 8ed7ac9d44 Use project.commit convenience method. 2015-04-24 12:29:36 +02:00