Commit Graph
14508 Commits
Author SHA1 Message Date
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
Dmitriy Zaporozhets 8c47a72a4e Merge branch 'project-existence-leak' into 'master'
Don't leak information about private project existence via Git-over-SSH/HTTP.

Fixes #2040 and https://gitlab.com/gitlab-org/gitlab-ce/issues/343.

Both `Grack::Auth` (used by Git-over-HTTP) and `Api::Internal /allowed` (used by gitlab-shell/Git-over-SSH) now return a generic "Not Found" error when the project exists but the user doesn't have access to it.

See merge request !1578
2015-03-03 20:05:12 +00:00
Marin Jankovski a7fad44bd3 Merge branch 'go-import' into 'master'
Render go-import meta tag for private repos.

The previously solution (626f5bab35) required a change to nginx config and broke visits from Googlebot and other clients including "go" in their user agent.

See merge request !1587
2015-03-03 19:53:20 +00:00
Marin Jankovski c5b66532df Merge branch 'master' of github.com:gitlabhq/gitlabhq 2015-03-03 11:50:30 -08:00
Marin Jankovski e6a0fb1f77 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2015-03-03 11:50:21 -08:00
Dmitriy Zaporozhets 4697daf71a Merge branch 'installtion-from-source' into 'master'
Clearly mark it as installation from source.

See merge request !1622
2015-03-03 19:16:52 +00:00
Dmitriy Zaporozhets d5d19a9fae Merge branch 'user-select-unassigned' into 'master'
Don't show Unassigned in user select when searching.

Fixes #2056.

When a search term is present, the Unassigned item isn't rendered, so the highlighted item is the first search result and hitting Enter works as expected.

See merge request !1620
2015-03-03 19:08:57 +00:00
Dmitriy Zaporozhets 93a21183a0 Merge branch 'case-sensetivity-import' into 'master'
Fix import check for case sensetive namespaces

If you already have namespace `ABc` and you try to import project with namespace `abC` - import will fail with 422 error.

cc @valery

See merge request !1618
2015-03-03 18:57:49 +00:00
Sytse Sijbrandij 3ff7189738 Clearly mark it as installation from source. 2015-03-03 10:01:49 -08:00
Jeroen van Baarsen c1fc29e1f8 Merge branch 'commit_calendar_branches' into 'master'
Count commits in branches as well in the commit calendar

This MR fixes a small bug in the commit calendar.
Currently only commits that are in the master branch are counted.
With this change, commits in other branches are included as well.

fixes one of the issues found in #1162

See merge request !362
2015-03-03 15:53:02 +00:00
Hannes Rosenögger 10212c01fd Count commits in branches as well in the commit calendar 2015-03-03 15:31:05 +01:00
Jeroen van Baarsen abc69c8905 Merge branch 'fix-merge-request-url-builder' into 'master'
Fix merge request URL passed to Webhooks

If you look at the data structure passed to Webhooks, you will see:

`"url"=>nil`

I don't think any of the Webhooks or services are using this yet, so right now nothing so far depends upon this value being correct.

See merge request !352
2015-03-03 13:18:23 +00:00
Douwe Maan 3102454a56 Don't show Unassigned in user select when searching. 2015-03-03 13:52:13 +01:00
Douwe Maan 3702c4ad80 Render go-import meta tag for private repos. 2015-03-03 11:22:30 +01:00
Douwe Maan d513ca584a Revert "Merge branch 'go-get-workaround-nginx' of https://github.com/mattes/gitlabhq into mattes-go-get-workaround-nginx"
This reverts commit 51349ca3c8, reversing
changes made to b180476bd6.
2015-03-03 11:21:48 +01:00
Douwe Maan 0e11be40c3 Add tests for GrackAuth. 2015-03-03 10:49:28 +01:00
Jeroen van Baarsen dbc61cfc0b Merge pull request #8911 from AKoetsier/changelog-8501
Fixed changelog for MR 8501
2015-03-03 10:32:23 +01:00
Andrès Koetsier 6f71f5bb1b Fixed changelog for MR 8501 2015-03-03 10:28:44 +01:00
Dmitriy Zaporozhets f438791721 Fix import check for case sensetive namespaces 2015-03-02 23:06:59 -08:00
Dmitriy Zaporozhets 2f4656b5c7 Merge branch 'strict-rubocop-rules' into 'master'
Enable ParenthesesAsGroupedExpression rule

See merge request !1617
2015-03-03 05:58:14 +00:00
Dmitriy Zaporozhets d874c821b4 Merge branch 'brakeman' into 'master'
Add Brakeman - Static analysis security scanner for Ruby on Rails

See merge request !1616
2015-03-03 05:57:47 +00:00
Dmitriy Zaporozhets 8348e1a9b5 Enable ParenthesesAsGroupedExpression rule 2015-03-02 18:45:28 -08:00
Dmitriy Zaporozhets f850cff417 Update ci setup documenation 2015-03-02 18:34:29 -08:00
Dmitriy Zaporozhets be165b18d0 Add brakeman and jasmine 2015-03-02 18:22:37 -08:00
Dmitriy Zaporozhets 16e899ca8b Add brakeman rake task and improve code security 2015-03-02 18:11:50 -08:00
Dmitriy Zaporozhets cc877c53ab Add rake task for brakeman 2015-03-02 17:41:05 -08:00
Dmitriy Zaporozhets 5b2b9a1f1f Add brakeman gem 2015-03-02 17:28:47 -08:00
Dmitriy Zaporozhets 704d21f517 Merge branch 'cirosantilli-link-to-button' into 'master'
Cirosantilli link to button

For https://github.com/gitlabhq/gitlabhq/pull/7912

See merge request !1614
2015-03-03 00:46:44 +00:00
Dmitriy Zaporozhets 3cc55fe4fe Merge branch 'master' of github.com:gitlabhq/gitlabhq 2015-03-02 15:30:52 -08:00
Dmitriy Zaporozhets 3087be1be7 Merge branch 'less-sql-queries' into 'master'
Reduce amount of sql queries on dashboard projects page

For https://github.com/gitlabhq/gitlabhq/issues/7218

See merge request !1613
2015-03-02 23:30:27 +00:00
Dmitriy Zaporozhets 519ca7bae9 Merge branch 'link-to-button' of https://github.com/cirosantilli/gitlabhq into cirosantilli-link-to-button
Conflicts:
	app/views/shared/_issuable_filter.html.haml
2015-03-02 15:28:22 -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 7faae7c163 Merge pull request #8092 from cirosantilli/factor-finder-perms
Factor permission check in issuable finder
2015-03-02 15:24:59 -08:00
Dmitriy Zaporozhets eb865c43d0 Merge pull request #8349 from divineforest/cleanup-assets-compress
Remove useless `assets.compress` option, Rails 4 uses only `assets.js_co...
2015-03-02 15:23:57 -08:00
Dmitriy Zaporozhets 33e107127a Merge pull request #8812 from opichals/teamcity_branchName_not_to_be_whole_ref
Fix for TeamCity buildQueue REST API build/@branchName.
2015-03-02 15:23:15 -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
Dmitriy Zaporozhets 12581f15ee Merge pull request #7473 from sodabrew/patch-1
Improve login screen when only OmniAuth providers are enabled
2015-03-02 15:18:59 -08:00
Dmitriy Zaporozhets e39bf83770 Merge pull request #8501 from AKoetsier/slack_channel_and_username
Allow a user to specify a channel and username for the slack-webhook
2015-03-02 15:17:56 -08:00
Dmitriy Zaporozhets f84bd771d4 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2015-03-02 14:55:45 -08:00
Dmitriy Zaporozhets 229eb732f5 Merge branch 'project-refs-with-digit-prefix' into 'master'
Support referencing issues to a project whose name starts with a digit

Gitlab supports adding users or projects whose name starts with a "_" or a digit, but the regexp in markdown.rb enforces "a-zA-Z" for the first character.

This change allows to reference issues or merge requests in other projects whose name starts with a digit, like `owner/2ndtestproject#123` or `2nduser/superproject!123`.

See merge request !264
2015-03-02 22:51:42 +00:00
Dmitriy Zaporozhets c530ca00b0 Merge branch 'fix-protected-branches-routing' into 'master'
Fix protected branches routing

### Summary

On the master branch, if you attempt to access the protected branches in the project settings with an empty repo, you get `NoMethodError - undefined method "project_url"`.

### Steps to reproduce

1. Check out GitLab master and run.
2. Create a new project.
3. Go to Settings.
4. Click on "Protected branches"

### Expected behavior

The controller is supposed to redirect back to the projects page since there are no branches.

### Observed behavior

Internal Error 500

### Relevant logs

```
NoMethodError - undefined method `project_url' for #<Projects::ProtectedBranchesController:0x007fd920054af0>:
  app/controllers/application_controller.rb:157:in `method_missing'
  actionpack (4.1.9) lib/action_dispatch/routing/polymorphic_routes.rb:142:in `polymorphic_url'
  actionpack (4.1.9) lib/action_dispatch/routing/url_for.rb:161:in `url_for'
  actionpack (4.1.9) lib/action_controller/metal/redirecting.rb:91:in `_compute_redirect_to_location'
  turbolinks (2.0.0) lib/turbolinks.rb:15:in `_compute_redirect_to_location_with_xhr_referer'
  actionpack (4.1.9) lib/action_controller/metal/redirecting.rb:71:in `redirect_to
```

### Fix

I added a unit test for the empty project case and replicated the issue. I added the URL router helpers that appear to be necessary after 42387b733b.

See merge request !359
2015-03-02 22:39:28 +00:00
Dmitriy Zaporozhets 27e7534470 Merge pull request #8829 from ZeoAlliance/merge_request_diff_view_fix
[bugfix] Merge request diff view behaviour fix
2015-03-02 14:28:21 -08:00
Dmitriy Zaporozhets 643afcbe00 Reduce amount of sql queries on dashboard projects page 2015-03-02 14:02:09 -08:00
Dmitriy Zaporozhets ed3bd155fc Merge branch 'master' of github.com:gitlabhq/gitlabhq 2015-03-02 13:45:46 -08:00
Dmitriy Zaporozhets 70e3409a50 Merge branch 'shell-paths' into 'master'
More reasons why prefixing is good

Inspired by http://www.dwheeler.com/essays/filenames-in-shell.html

See merge request !1604
2015-03-02 21:37:10 +00:00
Dmitriy Zaporozhets 6d1cc94849 Merge branch 'note-attachments-redirect-comment' into 'master'
Add comment about note attachment redirect.

See merge request !1612
2015-03-02 21:36:05 +00:00
Marin Jankovski dae8f2faeb Merge branch 'create_issue_header' into 'master'
New Issue Header

Fixes #2073

- I've switched it from "New Issue" to "Create Issue". Small change, but grammatically correct.

See merge request !1611
2015-03-02 20:58:38 +00:00
Douwe Maan dd37a10df4 Don't leak information about private project existence via Git-over-SSH/HTTP. 2015-03-02 17:52:48 +01:00
Nicolas Bouilleaud 8d0690c5c7 Support names starting with a digit or _ for projects and users
This is what’s actually allowed when creating a user or a project in gitlab.
2015-03-02 11:01:17 +01:00
Stan Hu 4bc5c66fe1 Fix broken project_url routing when protected branches are accessed with an empty repo 2015-03-01 20:26:21 -08:00