Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
aa45668216
commit
1fa5d56fec
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
status: proposed
|
||||
creation-date: "2023-10-10"
|
||||
authors: [ "@thomasrandolph", "@patrickbajao", "@igor.drozdov", "@jerasmus", "@iamphill", "@slashmanov", "@psjakubowska" ]
|
||||
coach: [ "@ntepluhina" ]
|
||||
approvers: [ ]
|
||||
owning-stage: "~devops::create"
|
||||
participating-stages: []
|
||||
---
|
||||
|
||||
This is an appendix to the [New Diffs document](index.md).
|
||||
|
||||
# Diffs features
|
||||
|
||||
Below is a complete list of features for merge request and commit diffs grouped by diff viewers (Code, Image, Other).
|
||||
|
||||
✓ – available in both MR and Commit views.
|
||||
|
||||
| Features | Code | Image | Other |
|
||||
|-----------------------------------|--------|-------|-------|
|
||||
| Filename | ✓ | ✓ | ✓ |
|
||||
| Copy file path | ✓ | ✓ | ✓ |
|
||||
| Collapse and expand file | ✓ | ✓ | ✓ |
|
||||
| File stats | ✓ | ✓ | ✓ |
|
||||
| Lines changed (0 for blobs) | ✓ | ✓ | ✓ |
|
||||
| Permissions changed | ✓ | ✓ | ✓ |
|
||||
| CRUD comment on file | ✓ | ✓ | ✓ |
|
||||
| View file link | ✓ | ✓ | ✓ |
|
||||
| Mark as viewed | MR | MR | MR |
|
||||
| Hide all comments | MR | MR | MR |
|
||||
| Show full file (expand all lines) | MR | | |
|
||||
| Open in Web IDE link | MR | | |
|
||||
| Line link | ✓ | | |
|
||||
| Edit file link | ✓ | | |
|
||||
| Code highlight (multiple themes) | ✓ | | |
|
||||
| Expand lines | ✓ | | |
|
||||
| CRUD comment on specific line | Commit | | |
|
||||
| CRUD comment on line range | MR | | |
|
||||
| Draft comment on line range | MR | | |
|
||||
| Code quality highlights | ✓ | | |
|
||||
| Test coverage highlights | ✓ | | |
|
||||
| Hide whitespace changes | ✓ | | |
|
||||
| Auto-collapse large file | ✓ | | |
|
||||
| View as raw | Commit | | |
|
||||
| Side by side view | | ✓ | |
|
||||
|
|
@ -20,6 +20,8 @@ to develop a single, performant way for diffs to be rendered across the applicat
|
|||
to improve all areas of diff rendering, from the backend creation of diffs to the frontend rendering
|
||||
the diffs.
|
||||
|
||||
All the diffs features related to this document are [listed on a dedicated page](features.md).
|
||||
|
||||
## Motivation
|
||||
|
||||
### Goals
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test-
|
|||
- To test Self Managed instances, follow [Cloud Activation steps](../../administration/license.md#activate-gitlab-ee) using the cloud activation code you received earlier.
|
||||
- To test SaaS, follow [Activate GitLab Enterprise license](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/index.md#use-gitlab-enterprise-features) with your license file.
|
||||
1. Export these environment variables in the same terminal session with `gdk start`:
|
||||
- Note that you can also configure your terminal always export the environment variables (e.g. adding the exports to `~/.bash_profile` or `~/.zshrc`).
|
||||
|
||||
```shell
|
||||
export AI_GATEWAY_URL=http://0.0.0.0:5052 # URL to the local AI Gateway instance
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ Most cases can be mitigated by limiting the rate of requests from a single IP ad
|
|||
Most [brute-force attacks](https://en.wikipedia.org/wiki/Brute-force_attack) are
|
||||
similarly mitigated by a rate limit.
|
||||
|
||||
NOTE:
|
||||
[In GitLab 14.8 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/344807), the rate limits for API requests do not affect requests made by the frontend, because these requests are always counted as web traffic.
|
||||
|
||||
## Configurable limits
|
||||
|
||||
You can set these rate limits in the Admin Area of your instance:
|
||||
|
|
|
|||
|
|
@ -265,6 +265,40 @@ module Gitlab
|
|||
set_note_author
|
||||
# attachment is deprecated and note uploads are handled by Markdown uploader
|
||||
@relation_hash['attachment'] = nil
|
||||
|
||||
setup_diff_note
|
||||
end
|
||||
|
||||
def setup_diff_note
|
||||
return unless @relation_hash['type'] == 'DiffNote'
|
||||
|
||||
update_diff_note_position('position')
|
||||
update_diff_note_position('original_position')
|
||||
update_diff_note_position('change_position')
|
||||
end
|
||||
|
||||
def update_diff_note_position(position)
|
||||
return unless @relation_hash[position]
|
||||
return unless @relation_hash.dig(position, 'line_range', 'start_line_code')
|
||||
|
||||
line_range = @relation_hash[position].delete('line_range')
|
||||
start_lines = line_range['start_line_code'].split('_').map(&:to_i)
|
||||
end_lines = line_range['end_line_code'].split('_').map(&:to_i)
|
||||
|
||||
@relation_hash[position]['line_range'] = {
|
||||
'start' => {
|
||||
'line_code' => line_range['start_line_code'],
|
||||
'type' => line_range['start_line_type'],
|
||||
'old_line' => start_lines[1] == 0 ? nil : start_lines[1].to_i,
|
||||
'new_line' => start_lines[2] == 0 ? nil : start_lines[2].to_i
|
||||
},
|
||||
'end' => {
|
||||
'line_code' => line_range['end_line_code'],
|
||||
'type' => line_range['end_line_type'],
|
||||
'old_line' => end_lines[1] == 0 ? nil : end_lines[1].to_i,
|
||||
'new_line' => end_lines[2] == 0 ? nil : end_lines[2].to_i
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
# Sets the author for a note. If the user importing the project
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@
|
|||
"gettext-parser": "^6.0.0",
|
||||
"graphql": "^15.7.2",
|
||||
"graphql-tag": "^2.11.0",
|
||||
"gridstack": "^10.0.1",
|
||||
"gridstack": "^10.1.0",
|
||||
"highlight.js": "^11.8.0",
|
||||
"immer": "^9.0.15",
|
||||
"ipaddr.js": "^1.9.1",
|
||||
|
|
|
|||
|
|
@ -559,4 +559,58 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
|
|||
include_examples 'access levels'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'diff notes' do
|
||||
context 'when relation is a diff note' do
|
||||
let(:relation_sym) { :notes }
|
||||
let(:line_range) do
|
||||
{
|
||||
"line_range" => {
|
||||
"start_line_code" => "abc_0_1",
|
||||
"start_line_type" => "new",
|
||||
"end_line_code" => "abc_5_10",
|
||||
"end_line_type" => "new"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
let(:relation_hash) do
|
||||
{
|
||||
'note' => 'note',
|
||||
'noteable_type' => 'MergeRequest',
|
||||
'type' => 'DiffNote',
|
||||
'position' => line_range,
|
||||
'original_position' => line_range,
|
||||
'change_position' => line_range
|
||||
}
|
||||
end
|
||||
|
||||
context 'when diff note line_range is in an outdated format' do
|
||||
it 'updates the line_range to the new format' do
|
||||
expect_next_instance_of(described_class) do |relation_factory|
|
||||
expect(relation_factory).to receive(:setup_models).and_call_original
|
||||
end
|
||||
|
||||
expected_line_range = {
|
||||
'start' => {
|
||||
'line_code' => 'abc_0_1',
|
||||
'type' => 'new',
|
||||
'old_line' => nil,
|
||||
'new_line' => 1
|
||||
},
|
||||
'end' => {
|
||||
'line_code' => 'abc_5_10',
|
||||
'type' => 'new',
|
||||
'old_line' => 5,
|
||||
'new_line' => 10
|
||||
}
|
||||
}
|
||||
|
||||
expect(created_object.position.line_range).to eq(expected_line_range)
|
||||
expect(created_object.original_position.line_range).to eq(expected_line_range)
|
||||
expect(created_object.change_position.line_range).to eq(expected_line_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7238,10 +7238,10 @@ graphql@^15.7.2:
|
|||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.7.2.tgz#85ab0eeb83722977151b3feb4d631b5f2ab287ef"
|
||||
integrity sha512-AnnKk7hFQFmU/2I9YSQf3xw44ctnSFCfp3zE0N6W174gqe9fWG/2rKaKxROK7CcI3XtERpjEKFqts8o319Kf7A==
|
||||
|
||||
gridstack@^10.0.1:
|
||||
version "10.0.1"
|
||||
resolved "https://registry.yarnpkg.com/gridstack/-/gridstack-10.0.1.tgz#5a0154ac4f4f18f7dfc7729c746616dd5fa69cbe"
|
||||
integrity sha512-0NeRtQ6LLENN+xdJnjneOhQw60I5NHJKgW1KWz/hau046KGlJUza0V2FcxvylzKNc8EXZbWc08tsw9T4ohs+Wg==
|
||||
gridstack@^10.1.0:
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/gridstack/-/gridstack-10.1.0.tgz#f6da65823f0d3cfe85f0248c2d13c0eb3462884a"
|
||||
integrity sha512-KmgSekEPa7aq4Vyfg4v8baCoRgWc9wtuli9hXnfI89ZUFfMJbn4w1bUaaMDVddvmcSdpU27xH07T17DpwHaLGQ==
|
||||
|
||||
gzip-size@^6.0.0:
|
||||
version "6.0.0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue