Commit Graph

107 Commits

Author SHA1 Message Date
GitLab Bot 3bd9ad5574 Add latest changes from gitlab-org/gitlab@master 2021-03-25 03:09:35 +00:00
GitLab Bot 889bf7a0ee Add latest changes from gitlab-org/gitlab@master 2021-03-16 18:11:53 +00:00
GitLab Bot 1fdc1d34e8 Add latest changes from gitlab-org/gitlab@master 2021-02-19 12:11:06 +00:00
GitLab Bot 9f5ac379c7 Add latest changes from gitlab-org/gitlab@master 2021-02-11 12:08:52 +00:00
GitLab Bot b5944525b0 Add latest changes from gitlab-org/gitlab@master 2021-02-09 21:09:19 +00:00
GitLab Bot ff06f859cd Add latest changes from gitlab-org/gitlab@master 2020-11-10 15:09:14 +00:00
GitLab Bot 2ac4833015 Add latest changes from gitlab-org/gitlab@master 2020-10-08 18:08:32 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
Patrick Derichs a13abd6731 Add edit_note and spec for editing quick actions
Call QuickActionsService on Note update

Add support for notes which just contain
commands after editing

Return http status gone (410) if note was deleted

Temporary frontend addition so it is not
failing when a note is deleted

Move specs to shared examples

Fix rubocop style issue

Deleting note on frontend when status is 410

Use guard clause for note which got deleted

Simplified condition for nil note

This method should no longer be called
with nil note

Refactoring of execute method to reduce
complexity

Move errors update to delete_note method

Note is now deleted visually when it only
contains commands after update

Add expectation

Fix style issues

Changing action to fix tests

Add tests for removeNote and update
deleteNote expectations
2019-08-26 09:20:00 +00:00
Patrick Derichs 0e99daae4a Use NotesFinder in IssuableActions module
Remove project from NotesFinder constructor

Add project parameter to specs

Also look for methods in private scope

Fix specs to match new NotesFinder constructor
2019-08-01 10:42:42 +02:00
Oswaldo Ferreira 86ead874e2 Resolve "Filter discussion (tab) by comments or activity in issues and merge requests" 2018-10-23 09:49:45 +00:00
gfyoung 12ee2753c1 Enable even more frozen string in app/controllers
Enables frozen string for some vestigial files as
well as the following:

* app/controllers/projects/**/*.rb
* app/controllers/sherlock/**/*.rb
* app/controllers/snippets/**/*.rb
* app/controllers/users/**/*.rb

Partially addresses #47424.
2018-09-25 22:43:49 -07:00
Bob Van Landuyt f1d3ea63cf Show the status of a user in interactions
The status is shown for
- The author of a commit when viewing a commit
- Notes on a commit (regular/diff)
- The user that triggered a pipeline when viewing a pipeline
- The author of a merge request when viewing a merge request
- The author of notes on a merge request (regular/diff)
- The author of an issue when viewing an issue
- The author of notes on an issue
- The author of a snippet when viewing a snippet
- The author of notes on a snippet
- A user's profile page
- The list of members of a group/user
2018-07-30 15:01:26 +02:00
blackst0ne 774ea41484 Clean up `notes_controller` 2018-05-14 18:53:57 +11:00
Jan Provaznik 7a76caa5a8 Merge request and commit discussions API 2018-05-01 12:39:44 +00:00
Yorick Peterse daad7144ec
Support Markdown rendering using multiple projects
This refactors the Markdown pipeline so it supports the rendering of
multiple documents that may belong to different projects. An example of
where this happens is when displaying the event feed of a group. In this
case we retrieve events for all projects in the group. Previously we
would group events per project and render these chunks separately, but
this would result in many SQL queries being executed. By extending the
Markdown pipeline to support this out of the box we can drastically
reduce the number of SQL queries.

To achieve this we introduce a new object to the pipeline:
Banzai::RenderContext. This object simply wraps two other objects: an
optional Project instance, and an optional User instance. On its own
this wouldn't be very helpful, but a RenderContext can also be used to
associate HTML documents with specific Project instances. This work is
done in Banzai::ObjectRenderer and allows us to reuse as many queries
(and results) as possible.
2018-04-11 14:10:19 +02:00
Fatih Acet 059ab73b8e Render MR Notes with Vue with behind a cookie 2018-02-28 00:10:43 +00:00
Yorick Peterse cca61980d5
Track and act upon the number of executed queries
This ensures that we have more visibility in the number of SQL queries
that are executed in web requests. The current threshold is hardcoded to
100 as we will rarely (maybe once or twice) change it.

In production and development we use Sentry if enabled, in the test
environment we raise an error. This feature is also only enabled in
production/staging when running on GitLab.com as it's not very useful to
other users.
2018-02-01 17:00:46 +01:00
Rémy Coutable 4af9d592c5 Replace factory_girl_rails with factory_bot_rails
I've followed the [upgrade guide](https://github.com/thoughtbot/factory_bot/blob/4-9-0-stable/UPGRADE_FROM_FACTORY_GIRL.md) and ran these two commands:

```
grep -e FactoryGirl **/*.rake **/*.rb -s -l | xargs sed -i "" "s|FactoryGirl|FactoryBot|"
grep -e factory_girl **/*.rake **/*.rb -s -l | xargs sed -i "" "s|factory_girl|factory_bot|"
```

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-12-14 15:01:55 +01:00
Jacopo 181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
Jarka Kadlecova 994e7d1359 Create system notes for MR too, improve doc + clean up code 2017-09-14 14:50:32 +02:00
Jarka Kadlecova 2b82f907ab Check the discussion lock only for issuables & clean style 2017-09-14 14:50:32 +02:00
Jarka Kadlecova b928720852 Support discussion locking in the backend 2017-09-14 14:50:32 +02:00
Jarka Kadlecova e4f7b87ddb Support comments for personal snippets 2017-05-05 15:45:49 +02:00
Jarka Kadlecova 8c3a03c1b9 Display comments for personal snippets 2017-05-02 13:07:53 +02:00
Douwe Maan 09330dd17c Remove unused code 2017-04-05 12:56:31 -05:00
Douwe Maan 21e10888c3
Address review comments 2017-04-05 17:44:14 +01:00
Douwe Maan fe26b8af94
Correctly display multiple separate discussions on the same diff line 2017-04-05 17:44:14 +01:00
Douwe Maan bb8cc94668
Don't use original_discussion_id 2017-04-05 17:44:14 +01:00
Douwe Maan 79889a6aa3
Add specs 2017-04-05 17:44:14 +01:00
Douwe Maan 9c30b0e918
Fix some specs 2017-04-05 17:44:14 +01:00
Douwe Maan 08bbb9fce6
Add option to start a new discussion on an MR 2017-04-05 17:44:14 +01:00
Adam Niedzielski 0a31efb577 Remove query parameters from notes polling endpoint to make caching easier 2017-03-01 16:34:28 +01:00
mhasbini 9f949d4e24 add /award slash command
add /award slash command; Allow posting of just an emoji in comment
2017-02-28 22:38:19 +02:00
dixpac 0dacf3c169 Fix inconsistent naming for services that delete things
* Changed name of delete_user_service and worker to destroy
* Move and change delete_group_service to Groups::DestroyService
* Rename Notes::DeleteService to Notes::DestroyService
2017-02-08 09:16:43 +01:00
Jarka Kadlecova 7ab3dd4b30 support `/merge` slash comand for MRs 2017-01-11 08:48:07 -05:00
Douwe Maan 12db4cc0e7 Merge branch 'jej-note-search-uses-finder' into 'security'
Fix missing Note access checks in by moving Note#search to updated NoteFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

## Which fixes are in this MR?

⚠️ - Potentially untested  
💣 - No test coverage  
🚥 - Test coverage of some sort exists (a test failed when error raised)  
🚦 - Test coverage of return value (a test failed when nil used)  
 - Permissions check tested

### Note lookup without access check

- [x]  app/finders/notes_finder.rb:13 :download_code check
- [x]  app/finders/notes_finder.rb:19 `SnippetsFinder`
- [x]  app/models/note.rb:121 [`Issue#visible_to_user`]
- [x]  lib/gitlab/project_search_results.rb:113
  - This is the only use of `app/models/note.rb:121` above, but importantly has no access checks at all. This means it leaks MR comments and snippets when those features are `team-only` in addition to the issue comments which would be fixed by `app/models/note.rb:121`.
  - It is only called from SearchController where `can?(current_user, :download_code, @project)` is checked, so commit comments are not leaked.

### Previous discussions
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_13_13 `: download_code` check on commit
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_19_19 `SnippetsFinder` should be used
  - `SnippetsFinder` should check if the snippets feature is enabled -> https://gitlab.com/gitlab-org/gitlab-ce/issues/25223

###  Acceptance criteria met?
- [x] Tests added for new code
- [x] TODO comments removed
- [x] Squashed and removed skipped tests
- [x] Changelog entry
- [ ] State Gitlab versions affected and issue severity in description
- [ ] Create technical debt issue for NotesFinder.
  - Either split into `NotesFinder::ForTarget` and `NotesFinder::Search` or consider object per notable type such as `NotesFinder::OnIssue`. For the first option could create `NotesFinder::Base` which is either inherited from or which can be included in the other two.
  - Avoid case statement anti-pattern in this finder with use of `NotesFinder::OnCommit` etc. Consider something on the finder for this? `Model.finder(user, project)`
  - Move `inc_author` to the controller, and implement `related_notes` to replace `non_diff_notes`/`mr_and_commit_notes`

See merge request !2035
2016-12-15 11:40:12 -03:00
Douwe Maan ba5e98bb70 Backport Note#commands_changes from EE 2016-11-24 14:32:32 +08:00
Ruben Davila 452d1d0824 Backport some changes done from Time Tracking feature in EE. 2016-11-18 21:19:04 -05:00
Douwe Maan 579951720a Merge branch 'diff-line-comment-vuejs' into 'master'
Diff line comments resolve

## What does this MR do?

Diff line comments can be resolved.

Part of #10325 

To do:

- [x] Backend (@DouweM)
  - [x] Fix https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5022#note_13319326. Will be made easier by https://gitlab.com/gitlab-org/gitlab-ce/issues/17237#note_13370331
  - [x] System note when all discussions are resolved
  - [x] Notification when all discussions are resolved
  - [x] Write unit tests
  - [x] Look at resolve time https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5022#note_13912743 - Fixed by 4a13aa9
- [x] Frontend (@iamphill)
  - [x] Fix bugs
  - [x] Write more feature tests 
- [x] Frontend (@connorshea)
  - [x] Address frontend feedback
  - [x] Feature specs for Jump feature
  - [x] Documentation
  - [x] Add Vue.js in a standard way

See merge request !5022
2016-08-19 02:24:34 +00:00
Douwe Maan 41007f6d3c Address review feedback 2016-08-16 11:04:26 -05:00
Rémy Coutable 0eea8c8857 Support slash commands in noteable description and notes
Some important things to note:

- commands are removed from noteable.description / note.note
- commands are translated to params so that they are treated as normal
  params in noteable Creation services
- the logic is not in the models but in the Creation services, which is
  the right place for advanced logic that has nothing to do with what
  models should be responsible of!
- UI/JS needs to be updated to handle notes which consist of commands
  only
- the `/merge` command is not handled yet

Other improvements:

- Don't process commands in commit notes and display a flash is note is only commands
- Add autocomplete for slash commands
- Add description and params to slash command DSL methods
- Ensure replying by email with a commands-only note works
- Use :subscription_event instead of calling noteable.subscribe
- Support :todo_event in IssuableBaseService

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:05:57 +02:00
Douwe Maan e257200459 Add specs for NotesController and DiscussionsController 2016-08-12 16:24:09 -05:00
Douwe Maan 9b115ce4d3 Actually don't send resolved notifications when deleting a note 2016-08-04 13:44:28 -07:00
Douwe Maan 1bee660b96 Don't send resolved notifications when deleting a note 2016-07-28 21:14:41 -06:00
Douwe Maan fa4a613517 Add 'Resolved all discussions' system note 2016-07-28 20:39:35 -06:00
Douwe Maan 1c2eefef3f Backend tweaks 2016-07-28 20:09:36 -06:00
Phil Hughes 2247d8a4fd Updates the text above discussions when resolving notes & discussions 2016-07-27 18:34:04 +01:00
Phil Hughes a678fef836 Added resolved by users name into tooltip 2016-07-26 15:47:19 +01:00
Douwe Maan eeb41c759e Add endpoints to resolve diff notes and discussions 2016-07-25 22:45:23 -06:00