383 Commits
Author SHA1 Message Date
Dmitriy Zaporozhets bfc8ded120 Merge branch 'last-deploy-key' into 'master'
Delete deploy key when last connection to a project is destroyed.

Addresses #1959.

See merge request !1710
2015-03-17 16:49:38 +00: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
Douwe Maan 7d2b34bd61 Satisfy Rubocop. 2015-03-17 16:00:32 +01:00
Douwe Maan 9c7fffb655 Delete deploy key when last connection to a project is destroyed. 2015-03-17 14:55:43 +01: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
Valery Sizov 410d25c8ca rename table subscribe; make it polymorfic 2015-03-16 15:22:50 +02:00
Valery Sizov 9698b36c1c Subscription 2015-03-15 19:44:59 +02:00
Douwe Maan 31fc73f0a9 Use project_member instead of team_member. 2015-03-15 13:50:38 +01:00
Vinnie Okada ad0ca0499a Merge branch 'master' into fix-restricted-visibility
Conflicts:
	db/schema.rb
2015-03-14 10:49:11 -06:00
Dmitriy Zaporozhets 309f588d56 Merge branch 'fix-encoding' into 'master'
Minor cleanup around UTF-8 encoding.

Minor cleanup to be merged after https://dev.gitlab.org/gitlab/gitlab_git/merge_requests/24 is merged in.

See merge request !1642
2015-03-13 16:50:53 +00:00
Douwe Maan 12b779e70b Move tag deletion to service and execute hooks and services. 2015-03-13 16:07:08 +01:00
Douwe Maan 7f4cffd88b Reuse blob object fetched by Gitlab::Git::Blame. 2015-03-13 13:49:27 +01:00
Douwe Maan f96dc6295a Everything from gitlab_git is already UTF-8. 2015-03-13 13:49:27 +01:00
Dmitriy Zaporozhets ec02cdf205 Merge branch 'master' into mr-filter-by-title
Conflicts:
	app/controllers/projects/merge_requests_controller.rb
2015-03-12 16:29:03 -07:00
Dmitriy Zaporozhets 80b2f3fb86 Implement merge requests search
It is same search like we have at issues page. It allows to quickly
filter merge requests based on title or desription. I copy-pasted some
js code from Issues.js. In future search (filtering) logic should be
refactoed into one class for merge requests and issues
2015-03-12 16:20:58 -07:00
Dmitriy Zaporozhets f0cbbd70bb Use same constant for amount of items per page 2015-03-12 15:37:00 -07:00
Dmitriy Zaporozhets 5f40253f76 Remove annoying notice messages when create/update merge request 2015-03-11 16:07:33 -07:00
Dmitriy Zaporozhets 961971544a Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2015-03-10 12:03:58 -07:00
Douwe Maan 383c56efa1 Use Gitlab::Git helper methods and constants as much as possible. 2015-03-10 13:39:31 +01:00
DJ Mountney 23fabc081d Fixing import redirect loop
While importing, don't redirect import actions to the project page, even if the repository exists
2015-03-09 16:36:41 -07:00
Vinnie Okada 928fc94c3d Enforce restricted visibilities for snippets
Add new service classes to create and update project and personal
snippets.  These classes are responsible for enforcing restricted
visibility settings for non-admin users.
2015-03-08 17:57:08 -06:00
Dmitriy Zaporozhets 8b551ee318 Merge branch 'emails-on-push'
Conflicts:
	app/controllers/projects/services_controller.rb
	app/models/project_services/emails_on_push_service.rb
2015-03-08 16:49:11 -07:00
Dmitriy Zaporozhets cec2be2d76 Merge branch 'fix-milestone-list-width' into 'master'
Fix width of text in milestone lists and add assignee icon to merge requests.

Before:

![Screen_Shot_2015-03-06_at_13.48.00](https://dev.gitlab.org/gitlab/gitlabhq/uploads/5754638a3ebb79dee1f6c07a6e268035/Screen_Shot_2015-03-06_at_13.48.00.png)

After:

![Screen_Shot_2015-03-06_at_13.48.14](https://dev.gitlab.org/gitlab/gitlabhq/uploads/fe92adf387964efb3d460dfc61ced3b8/Screen_Shot_2015-03-06_at_13.48.14.png)

I've checked with other screen widths as well, and it looks good all the time.

See merge request !1645
2015-03-08 23:41:26 +00:00
Dmitriy Zaporozhets 3cf4359b00 Merge branch 'mass-change-comments' into 'master'
Send notifications and leave system comments when bulk updating issues.

Resolves https://dev.gitlab.org/gitlab/gitlabhq/issues/1885.

See merge request !1646
2015-03-07 01:06:44 +00:00
Stan Hu 7e204cf389 Added comment notification events to HipChat and Slack services.
Supports four different event types all bundled under the "note" event type:

- comments on a commit
- comments on an issue
- comments on a merge request
- comments on a code snippet
2015-03-06 06:54:00 -08:00
Douwe Maan b673d87227 Send notifications and leave system comments when bulk updating issues. 2015-03-06 15:01:13 +01:00
Douwe Maan be94e13552 Add assignee icon to milestone merge requests. 2015-03-06 14:08:40 +01:00
Dmitriy Zaporozhets 63178a9509 Merge branch 'add-more-slack-notifications' into 'master'
Add more Slack notifications for issue and merge request events

From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/237 by Stan Hu.

See merge request !1556
2015-03-04 21:57:17 +00:00
Marin Jankovski 66fa4b09ed Merge branch 'fix-edit-note-with-votes' into 'master'
Fix server error when editing a note to "+1" or "-1"

### Summary

If a user edits a comment with "+1" or "-1" in the beginning, the POST returns an Internal Server error. (issue #1151). This merge request resolves that error.

### Steps to reproduce

1. Comment on an issue with "Test comment".
2. Edit the issue.
3. Write "+1" and click "Save Comment".

### Expected behavior

The edited note should be saved and refreshed. Any previous upvotes/downvotes from the user should contain a strikethrough.

### Observed behavior

Internal Error

### Relevant logs

```
Started PUT "/avocode/avocode-manager/notes/4996" for 185.33.136.107 at 2015-02-28 17:11:53 +0100
Processing by Projects::NotesController#update as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"*removed*", "note"=>{"note"=>"+1\r\n\r\nYes"}, "commit"=>"Save Comment", "project_id"=>"avocode/avocode-manager", "id"=>"4996"}
Completed 500 Internal Server Error in 86ms
ActionView::Template::Error (undefined method `each' for nil:NilClass):
28: %span.note-last-update
29: = note_timestamp(note)
30:
31: - if note.superceded?(@notes)
32: - if note.upvote?
33: %span.vote.upvote.label.label-gray.strikethrough
34: %i.fa.fa-thumbs-up
app/models/note.rb:495:in `superceded?'
app/views/projects/notes/_note.html.haml:31:in `_app_views_projects_notes__note_html_haml___812277000516355462_69988235638820'
app/controllers/projects/notes_controller.rb:71:in `note_to_html'
app/controllers/projects/notes_controller.rb:103:in `render_note_json'
app/controllers/projects/notes_controller.rb:39:in `block (2 levels) in update'
app/controllers/projects/notes_controller.rb:38:in `update'
```

### Fix

It turns out no tests were present for the "Edit Issue" functionality. I added spinach tests to exercise this and reproduced the error.

Most of the routes in `notes_controller.rb` appear to render all notes for the given discussion. `_form.html.haml` needs the full list of notes commented by the user to add strikethroughs for older upvotes/downvotes. However, only the `index` route appeared to obtain this information. The fix is to add a `before_filter` to obtain all the user's notes beforehand, except in the delete case where this information is not needed.

Things to watch: `NotesFinder` needs `target_type` and `target_id` to determine what to do. I'm not sure if there is a conscious effort to phase these keywords out in favor of `noteable_type` and `noteable_id`.

See merge request !360
2015-03-03 21:57:00 +00:00
Stan HuandDouwe Maan afe5d7d209 Issue #595: Support Slack notifications upon issue and merge request events
1) Adds a DB migration for all services to toggle on push, issue, and merge events.

2) Upon an issue or merge request event, fire service hooks.

3) Slack service supports custom messages for each of these events. Other services
not supported at the moment.

4) Label merge request hooks with their corresponding actions.
2015-03-03 11:14:31 +01:00
Dmitriy Zaporozhets 16e899ca8b Add brakeman rake task and improve code security 2015-03-02 18:11:50 -08:00
Stan Hu b8c9257fb1 Fix bug where editing a comment with "+1" or "-1" would cause a server error
Closes #1151
2015-03-02 15:26:00 -08:00
Dmitriy Zaporozhets f00feb14ec Merge branch 'add-irker-service' of https://github.com/Aorimn/gitlabhq into Aorimn-add-irker-service
Conflicts:
	app/controllers/projects/services_controller.rb
2015-03-02 15:22:31 -08:00
Aorimn f84b7eef3f Add Irker service
Irker is a gateway which sends IRC messages on git updates. This new
service provides an interface to this gateway, integrated in Gitlab, for
each updates.
As per the guidelines, this commit adds the new feature in the
CHANGELOG, tests and documentation.

See http://www.catb.org/esr/irker/
2015-03-01 20:51:03 +01:00
Andrès Koetsier d2c85a68bb Allow a user to specify a channel and username for the slack-webhook 2015-02-28 10:06:32 +01:00
Dmitriy Zaporozhets ada7d0f393 Merge branch 'update_update_project_milestone_path' into 'master'
Update project_milestone_path update route.

See merge request !1605
2015-02-27 17:41:04 +00:00
Dmitriy Zaporozhets 6ac0a0217c Fix syntax issue 2015-02-26 16:44:52 -08:00
Marin Jankovski 62a81494ba Update project_milestone_path update route. 2015-02-26 16:03:42 -08:00
Dmitriy Zaporozhets 128012dba8 More use of shortcut routes 2015-02-25 19:50:01 -08:00
Dmitriy Zaporozhets 1da71cc520 Introduce shortcuts for routing helpers 2015-02-25 19:34:16 -08:00
Douwe Maan 85af3e82bf Add option to disable code diffs to EmailOnPush.
See #1950
2015-02-25 14:29:49 +01:00
Douwe Maan e0c186c357 Add option to send EmailsOnPush from committer email if domain matches.
See #1809.
2015-02-25 14:20:35 +01:00
Douwe Maan 5f7a3e1bbd Merge branch 'master' into extend_markdown_upload
# Conflicts:
#	app/controllers/files_controller.rb
2015-02-25 11:59:25 +01:00
Douwe Maan 0283fff591 Merge branch 'master' into extend_markdown_upload
# Conflicts:
#	app/views/projects/issues/_form.html.haml
#	app/views/projects/merge_requests/_form.html.haml
#	app/views/projects/merge_requests/_new_submit.html.haml
#	app/views/projects/milestones/_form.html.haml
#	app/views/projects/notes/_form.html.haml
#	app/views/projects/wikis/_form.html.haml
#	config/routes.rb
#	spec/controllers/projects_controller_spec.rb
2015-02-24 14:54:39 +01:00
Valery Sizov 71a844cdae Web Editor: save to new branch 2015-02-24 11:43:20 +02:00
Dmitriy Zaporozhets 9459e9db24 Fix updating issue 500 error 2015-02-22 22:26:09 -08:00
Vinnie Okada 2a9eed6620 Merge branch 'master' into rails-4.1.9
Conflicts:
	app/views/projects/commits/_commit.html.haml
	app/views/projects/issues/_issue.html.haml
	app/views/projects/issues/_issue_context.html.haml
	app/views/projects/merge_requests/_merge_request.html.haml
	app/views/projects/merge_requests/show/_context.html.haml
2015-02-21 12:55:28 -07:00
Douwe Maan aba1251594 Merge branch 'master' into extend_markdown_upload 2015-02-21 13:46:58 +01:00
Dmitriy Zaporozhets 5484acd998 Merge branch 'empty-project-redirect-vs-404' into 'master'
Redirect from /tree/master on empty repo instead of showing 404.

See https://gitlab.com/gitlab-org/gitlab-ce/issues/1114

See merge request !1559
2015-02-21 02:01:21 +00:00