diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-15 06:09:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-15 06:09:42 +0300 |
commit | a3ac132686ea5e5e83c184334bf7f03bb641211c (patch) | |
tree | 3b4539cc9160c79b07e14637a97c67eb57ff3093 | |
parent | 0c6c91556b89efac59a1034f7f91fd37a7f8ea91 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue | 1 | ||||
-rw-r--r-- | app/models/issue.rb | 16 | ||||
-rw-r--r-- | config/feature_flags/development/evalute_protected_tag_for_release_permissions.yml | 2 | ||||
-rw-r--r-- | doc/administration/operations/extra_sidekiq_processes.md | 5 | ||||
-rw-r--r-- | doc/administration/operations/extra_sidekiq_routing.md | 4 | ||||
-rw-r--r-- | doc/user/project/releases/index.md | 6 | ||||
-rw-r--r-- | doc/user/project/repository/csv.md | 24 | ||||
-rw-r--r-- | doc/user/project/repository/img/csv_file_rendered_as_table_v14_1.png | bin | 0 -> 39700 bytes | |||
-rw-r--r-- | doc/user/project/settings/project_access_tokens.md | 6 | ||||
-rw-r--r-- | spec/models/concerns/awardable_spec.rb | 84 | ||||
-rw-r--r-- | spec/models/issue_spec.rb | 18 |
11 files changed, 113 insertions, 53 deletions
diff --git a/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue b/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue index a7ff9c0efc8..2e00a23de7c 100644 --- a/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue +++ b/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue @@ -125,6 +125,7 @@ export default { return { fullPath: this.attrWorkspacePath, title: this.searchTerm, + in: this.searchTerm && this.issuableAttribute === IssuableType.Epic ? 'TITLE' : undefined, state: this.$options.IssuableAttributeState[this.issuableAttribute], sort: this.issuableAttribute === IssuableType.Epic ? defaultEpicSort : null, }; diff --git a/app/models/issue.rb b/app/models/issue.rb index 7926c4be489..00fcba5298a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -196,11 +196,23 @@ class Issue < ApplicationRecord end end - # Alias to state machine .with_state_id method - # This needs to be defined after the state machine block to avoid errors class << self + extend ::Gitlab::Utils::Override + + # Alias to state machine .with_state_id method + # This needs to be defined after the state machine block to avoid errors alias_method :with_state, :with_state_id alias_method :with_states, :with_state_ids + + override :order_upvotes_desc + def order_upvotes_desc + reorder(upvotes_count: :desc) + end + + override :order_upvotes_asc + def order_upvotes_asc + reorder(upvotes_count: :asc) + end end def self.relative_positioning_query_base(issue) diff --git a/config/feature_flags/development/evalute_protected_tag_for_release_permissions.yml b/config/feature_flags/development/evalute_protected_tag_for_release_permissions.yml index 4c8e5abdd4d..a314c0263ba 100644 --- a/config/feature_flags/development/evalute_protected_tag_for_release_permissions.yml +++ b/config/feature_flags/development/evalute_protected_tag_for_release_permissions.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334368 milestone: '14.1' type: development group: group::release -default_enabled: false +default_enabled: true diff --git a/doc/administration/operations/extra_sidekiq_processes.md b/doc/administration/operations/extra_sidekiq_processes.md index d7f54c32563..1f195bcc378 100644 --- a/doc/administration/operations/extra_sidekiq_processes.md +++ b/doc/administration/operations/extra_sidekiq_processes.md @@ -74,8 +74,9 @@ To start multiple processes: just handles the `mailers` queue. When `sidekiq-cluster` is only running on a single node, make sure that at least - one process is running on all queues using `*`. This means a process is - This includes queues that have dedicated processes. + one process is running on all queues using `*`. This ensures a process + automatically picks up jobs in queues created in the future, + including queues that have dedicated processes. If `sidekiq-cluster` is running on more than one node, you can also use [`--negate`](#negate-settings) and list all the queues that are already being diff --git a/doc/administration/operations/extra_sidekiq_routing.md b/doc/administration/operations/extra_sidekiq_routing.md index 93cf8bd4f43..80540b7ba46 100644 --- a/doc/administration/operations/extra_sidekiq_routing.md +++ b/doc/administration/operations/extra_sidekiq_routing.md @@ -41,7 +41,7 @@ In `/etc/gitlab/gitlab.rb`: ```ruby sidekiq['routing_rules'] = [ # Route all non-CPU-bound workers that are high urgency to `high-urgency` queue - ['resource_boundary!=cpu&urgency=high', 'high-urgency'], + ['resource_boundary!=cpu&urgency=high', 'high-urgency'], # Route all database, gitaly and global search workers that are throttled to `throttled` queue ['feature_category=database,gitaly,global_search&urgency=throttled', 'throttled'], # Route all workers having contact with outside work to a `network-intenstive` queue @@ -99,7 +99,7 @@ based on a subset of worker attributes: - `urgency` - how important it is that this queue's jobs run quickly. Can be `high`, `low`, or `throttled`. For example, the `authorized_projects` queue is used to refresh user permissions, and - is high urgency. + is `high` urgency. - `worker_name` - the worker name. The other attributes are typically more useful as they are more general, but this is available in case a particular worker needs to be selected. diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md index d82a27aaebf..3a25b148fdf 100644 --- a/doc/user/project/releases/index.md +++ b/doc/user/project/releases/index.md @@ -591,10 +591,10 @@ and set **Maintainer** in the **Allowed to create** column. #### Enable or disable protected tag evaluation on releases **(FREE SELF)** -Protected tag evaluation on release permissions is under development and not ready for production use. -It is deployed behind a feature flag that is **disabled by default**. +Protected tag evaluation on release permissions is under development but ready for production use. +It is deployed behind a feature flag that is **enabled by default**. [GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md) -can enable it. +can opt to disable it. To enable it: diff --git a/doc/user/project/repository/csv.md b/doc/user/project/repository/csv.md new file mode 100644 index 00000000000..9ab26d42e72 --- /dev/null +++ b/doc/user/project/repository/csv.md @@ -0,0 +1,24 @@ +--- +stage: Create +group: Source Code +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments +type: reference +--- + +# CSV files **(FREE)** + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14174) in GitLab 14.1. + +A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. +Each line of the file is a data record. Each record consists of one or more fields, separated by +commas. The use of the comma as a field separator is the source of the name for this file format. +A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line +will have the same number of fields. + +The CSV file format is not fully standardized. Other characters can be used as column delimiters. +Fields may or may not be surrounded to escape special characrers. + +When added to a repository, files with a `.csv` extension are rendered as a table when viewed in +GitLab. + +![CSV file rendered as a table](img/csv_file_rendered_as_table_v14_1.png) diff --git a/doc/user/project/repository/img/csv_file_rendered_as_table_v14_1.png b/doc/user/project/repository/img/csv_file_rendered_as_table_v14_1.png Binary files differnew file mode 100644 index 00000000000..0f9b623e7b4 --- /dev/null +++ b/doc/user/project/repository/img/csv_file_rendered_as_table_v14_1.png diff --git a/doc/user/project/settings/project_access_tokens.md b/doc/user/project/settings/project_access_tokens.md index bcdb0bbdde4..75face315e4 100644 --- a/doc/user/project/settings/project_access_tokens.md +++ b/doc/user/project/settings/project_access_tokens.md @@ -17,7 +17,11 @@ Project access tokens are supported for self-managed instances on Free and above WARNING: This feature might not be available to you. Check the **version history** note above for details. -Project access tokens are scoped to a project and can be used to authenticate with the [GitLab API](../../../api/index.md#personalproject-access-tokens). You can also use project access tokens with Git to authenticate over HTTP. +Project access tokens are scoped to a project and can be used to authenticate with the +[GitLab API](../../../api/index.md#personalproject-access-tokens). You can also use +project access tokens with Git to authenticate over HTTPS. If you are asked for a +username when authenticating over HTTPS, you can use any non-empty value because only +the token is needed. Project access tokens expire on the date you define, at midnight UTC. diff --git a/spec/models/concerns/awardable_spec.rb b/spec/models/concerns/awardable_spec.rb index b80b6ec95e2..fcd0d0c05f4 100644 --- a/spec/models/concerns/awardable_spec.rb +++ b/spec/models/concerns/awardable_spec.rb @@ -3,64 +3,64 @@ require 'spec_helper' RSpec.describe Awardable do - let!(:issue) { create(:issue) } - let!(:award_emoji) { create(:award_emoji, :downvote, awardable: issue) } + let!(:note) { create(:note) } + let!(:award_emoji) { create(:award_emoji, :downvote, awardable: note) } describe "Associations" do - subject { build(:issue) } + subject { build(:note) } it { is_expected.to have_many(:award_emoji).dependent(:destroy) } end describe "ClassMethods" do - let!(:issue2) { create(:issue) } - let!(:award_emoji2) { create(:award_emoji, awardable: issue2) } + let!(:note2) { create(:note) } + let!(:award_emoji2) { create(:award_emoji, awardable: note2) } describe "orders" do it "orders on upvotes" do - expect(Issue.order_upvotes_desc.to_a).to eq [issue2, issue] + expect(Note.order_upvotes_desc.to_a).to eq [note2, note] end it "orders on downvotes" do - expect(Issue.order_downvotes_desc.to_a).to eq [issue, issue2] + expect(Note.order_downvotes_desc.to_a).to eq [note, note2] end end describe "#awarded" do it "filters by user and emoji name" do - expect(Issue.awarded(award_emoji.user, "thumbsup")).to be_empty - expect(Issue.awarded(award_emoji.user, "thumbsdown")).to eq [issue] - expect(Issue.awarded(award_emoji2.user, "thumbsup")).to eq [issue2] - expect(Issue.awarded(award_emoji2.user, "thumbsdown")).to be_empty + expect(Note.awarded(award_emoji.user, "thumbsup")).to be_empty + expect(Note.awarded(award_emoji.user, "thumbsdown")).to eq [note] + expect(Note.awarded(award_emoji2.user, "thumbsup")).to eq [note2] + expect(Note.awarded(award_emoji2.user, "thumbsdown")).to be_empty end it "filters by user and any emoji" do - issue3 = create(:issue) - create(:award_emoji, awardable: issue3, name: "star", user: award_emoji.user) - create(:award_emoji, awardable: issue3, name: "star", user: award_emoji2.user) + note3 = create(:note) + create(:award_emoji, awardable: note3, name: "star", user: award_emoji.user) + create(:award_emoji, awardable: note3, name: "star", user: award_emoji2.user) - expect(Issue.awarded(award_emoji.user)).to contain_exactly(issue, issue3) - expect(Issue.awarded(award_emoji2.user)).to contain_exactly(issue2, issue3) + expect(Note.awarded(award_emoji.user)).to contain_exactly(note, note3) + expect(Note.awarded(award_emoji2.user)).to contain_exactly(note2, note3) end end describe "#not_awarded" do - it "returns issues not awarded by user" do - expect(Issue.not_awarded(award_emoji.user)).to eq [issue2] - expect(Issue.not_awarded(award_emoji2.user)).to eq [issue] + it "returns notes not awarded by user" do + expect(Note.not_awarded(award_emoji.user)).to eq [note2] + expect(Note.not_awarded(award_emoji2.user)).to eq [note] end end end describe "#upvotes" do it "counts the number of upvotes" do - expect(issue.upvotes).to be 0 + expect(note.upvotes).to be 0 end end describe "#downvotes" do it "counts the number of downvotes" do - expect(issue.downvotes).to be 1 + expect(note.downvotes).to be 1 end end @@ -68,67 +68,67 @@ RSpec.describe Awardable do let(:user) { create(:user) } before do - issue.project.add_guest(user) + note.project.add_guest(user) end it 'is truthy when the user is allowed to award emoji' do - expect(issue.user_can_award?(user)).to be_truthy + expect(note.user_can_award?(user)).to be_truthy end it 'is falsy when the project is archived' do - issue.project.update!(archived: true) + note.project.update!(archived: true) - expect(issue.user_can_award?(user)).to be_falsy + expect(note.user_can_award?(user)).to be_falsy end end describe 'querying award_emoji on an Awardable' do - let(:issue) { create(:issue) } + let(:note) { create(:note) } it 'sorts in ascending fashion' do - create_list(:award_emoji, 3, awardable: issue) + create_list(:award_emoji, 3, awardable: note) - expect(issue.award_emoji).to eq issue.award_emoji.sort_by(&:id) + expect(note.award_emoji).to eq note.award_emoji.sort_by(&:id) end end describe "#grouped_awards" do context 'default award emojis' do - let(:issue_without_downvote) { create(:issue) } - let(:issue_with_downvote) do - issue_with_downvote = create(:issue) - create(:award_emoji, :downvote, awardable: issue_with_downvote) - issue_with_downvote + let(:note_without_downvote) { create(:note) } + let(:note_with_downvote) do + note_with_downvote = create(:note) + create(:award_emoji, :downvote, awardable: note_with_downvote) + note_with_downvote end it "includes unused thumbs buttons by default" do - expect(issue_without_downvote.grouped_awards.keys.sort).to eq %w(thumbsdown thumbsup) + expect(note_without_downvote.grouped_awards.keys.sort).to eq %w(thumbsdown thumbsup) end it "doesn't include unused thumbs buttons when disabled in project" do - issue_without_downvote.project.show_default_award_emojis = false + note_without_downvote.project.show_default_award_emojis = false - expect(issue_without_downvote.grouped_awards.keys.sort).to be_empty + expect(note_without_downvote.grouped_awards.keys.sort).to be_empty end it "includes unused thumbs buttons when enabled in project" do - issue_without_downvote.project.show_default_award_emojis = true + note_without_downvote.project.show_default_award_emojis = true - expect(issue_without_downvote.grouped_awards.keys.sort).to eq %w(thumbsdown thumbsup) + expect(note_without_downvote.grouped_awards.keys.sort).to eq %w(thumbsdown thumbsup) end it "doesn't include unused thumbs buttons in summary" do - expect(issue_without_downvote.grouped_awards(with_thumbs: false).keys).to be_empty + expect(note_without_downvote.grouped_awards(with_thumbs: false).keys).to be_empty end it "includes used thumbs buttons when disabled in project" do - issue_with_downvote.project.show_default_award_emojis = false + note_with_downvote.project.show_default_award_emojis = false - expect(issue_with_downvote.grouped_awards.keys).to eq %w(thumbsdown) + expect(note_with_downvote.grouped_awards.keys).to eq %w(thumbsdown) end it "includes used thumbs buttons in summary" do - expect(issue_with_downvote.grouped_awards(with_thumbs: false).keys).to eq %w(thumbsdown) + expect(note_with_downvote.grouped_awards(with_thumbs: false).keys).to eq %w(thumbsdown) end end end diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 1aa9019d240..441446bae60 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -128,6 +128,24 @@ RSpec.describe Issue do end end + context 'order by upvotes' do + let!(:issue) { create(:issue) } + let!(:issue2) { create(:issue) } + let!(:award_emoji) { create(:award_emoji, :upvote, awardable: issue2) } + + describe '.order_upvotes_desc' do + it 'orders on upvotes' do + expect(described_class.order_upvotes_desc.to_a).to eq [issue2, issue] + end + end + + describe '.order_upvotes_asc' do + it 'orders on upvotes' do + expect(described_class.order_upvotes_asc.to_a).to eq [issue, issue2] + end + end + end + describe '.with_alert_management_alerts' do subject { described_class.with_alert_management_alerts } |