diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-25 00:09:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-25 00:09:59 +0300 |
commit | 8a0ba602908b4360f52bf64fb715585d6245079e (patch) | |
tree | 0b9d005b11e26f2db40ce87d736abbb8fef7f755 | |
parent | e9322e019bfeb7f33ce4c17662d93e6579303c2b (diff) |
Add latest changes from gitlab-org/gitlab@master
34 files changed, 76 insertions, 252 deletions
diff --git a/app/assets/javascripts/ide/utils.js b/app/assets/javascripts/ide/utils.js index 53d3b853f03..ec3630cc5eb 100644 --- a/app/assets/javascripts/ide/utils.js +++ b/app/assets/javascripts/ide/utils.js @@ -44,8 +44,8 @@ const KNOWN_TYPES = [ ]; export function isTextFile({ name, raw, binary, content, mimeType = '' }) { - // some file objects already have a `binary` property set on them. If true, return false - if (binary) return false; + // some file objects already have a `binary` property set on them. If so, use it first + if (typeof binary === 'boolean') return !binary; const knownType = KNOWN_TYPES.find((type) => type.isMatch(mimeType, name)); if (knownType) return knownType.isText; diff --git a/app/assets/javascripts/pages/admin/application_settings/index.js b/app/assets/javascripts/pages/admin/application_settings/index.js index a6e3a7dc08a..1924326da1f 100644 --- a/app/assets/javascripts/pages/admin/application_settings/index.js +++ b/app/assets/javascripts/pages/admin/application_settings/index.js @@ -1,5 +1,4 @@ import initVariableList from '~/ci_variable_list'; -import projectSelect from '~/project_select'; import initSearchSettings from '~/search_settings'; import selfMonitor from '~/self_monitor'; import initSettingsPanels from '~/settings_panels'; @@ -8,5 +7,4 @@ initVariableList('js-instance-variables'); selfMonitor(); // Initialize expandable settings panels initSettingsPanels(); -projectSelect(); initSearchSettings(); diff --git a/app/assets/javascripts/pages/dashboard/issues/index.js b/app/assets/javascripts/pages/dashboard/issues/index.js index 3e09b1796b1..230ed9b1dba 100644 --- a/app/assets/javascripts/pages/dashboard/issues/index.js +++ b/app/assets/javascripts/pages/dashboard/issues/index.js @@ -2,7 +2,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered import initManualOrdering from '~/manual_ordering'; import { FILTERED_SEARCH } from '~/pages/constants'; import initFilteredSearch from '~/pages/search/init_filtered_search'; -import projectSelect from '~/project_select'; initFilteredSearch({ page: FILTERED_SEARCH.ISSUES, @@ -10,5 +9,4 @@ initFilteredSearch({ useDefaultState: true, }); -projectSelect(); initManualOrdering(); diff --git a/app/assets/javascripts/pages/dashboard/merge_requests/index.js b/app/assets/javascripts/pages/dashboard/merge_requests/index.js index 6c134e4fad6..c0d026422cb 100644 --- a/app/assets/javascripts/pages/dashboard/merge_requests/index.js +++ b/app/assets/javascripts/pages/dashboard/merge_requests/index.js @@ -2,7 +2,6 @@ import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; import { FILTERED_SEARCH } from '~/pages/constants'; import initFilteredSearch from '~/pages/search/init_filtered_search'; -import projectSelect from '~/project_select'; addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys, true); @@ -11,5 +10,3 @@ initFilteredSearch({ filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, useDefaultState: true, }); - -projectSelect(); diff --git a/app/assets/javascripts/pages/dashboard/milestones/index/index.js b/app/assets/javascripts/pages/dashboard/milestones/index/index.js deleted file mode 100644 index b526fce6f7b..00000000000 --- a/app/assets/javascripts/pages/dashboard/milestones/index/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import projectSelect from '~/project_select'; - -projectSelect(); diff --git a/app/assets/javascripts/pages/groups/issues/index.js b/app/assets/javascripts/pages/groups/issues/index.js index 342c054471d..af36139dd13 100644 --- a/app/assets/javascripts/pages/groups/issues/index.js +++ b/app/assets/javascripts/pages/groups/issues/index.js @@ -4,7 +4,6 @@ import { mountIssuablesListApp } from '~/issues_list'; import initManualOrdering from '~/manual_ordering'; import { FILTERED_SEARCH } from '~/pages/constants'; import initFilteredSearch from '~/pages/search/init_filtered_search'; -import projectSelect from '~/project_select'; const ISSUE_BULK_UPDATE_PREFIX = 'issue_'; @@ -18,7 +17,6 @@ initFilteredSearch({ useDefaultState: true, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, }); -projectSelect(); initManualOrdering(); if (gon.features?.vueIssuablesList) { diff --git a/app/assets/javascripts/pages/groups/merge_requests/index.js b/app/assets/javascripts/pages/groups/merge_requests/index.js index 02a0a50f984..b1fcc110a90 100644 --- a/app/assets/javascripts/pages/groups/merge_requests/index.js +++ b/app/assets/javascripts/pages/groups/merge_requests/index.js @@ -3,7 +3,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered import issuableInitBulkUpdateSidebar from '~/issuable_bulk_update_sidebar/issuable_init_bulk_update_sidebar'; import { FILTERED_SEARCH } from '~/pages/constants'; import initFilteredSearch from '~/pages/search/init_filtered_search'; -import projectSelect from '~/project_select'; const ISSUABLE_BULK_UPDATE_PREFIX = 'merge_request_'; @@ -16,4 +15,3 @@ initFilteredSearch({ useDefaultState: true, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, }); -projectSelect(); diff --git a/app/models/concerns/cache_markdown_field.rb b/app/models/concerns/cache_markdown_field.rb index 3753a14ad40..9414d16beef 100644 --- a/app/models/concerns/cache_markdown_field.rb +++ b/app/models/concerns/cache_markdown_field.rb @@ -160,39 +160,6 @@ module CacheMarkdownField # We can only store mentions if the mentionable is a database object return unless self.is_a?(ApplicationRecord) - return store_mentions_without_subtransaction! if Feature.enabled?(:store_mentions_without_subtransaction, default_enabled: :yaml) - - refs = all_references(self.author) - - references = {} - references[:mentioned_users_ids] = refs.mentioned_user_ids.presence - references[:mentioned_groups_ids] = refs.mentioned_group_ids.presence - references[:mentioned_projects_ids] = refs.mentioned_project_ids.presence - - # One retry is enough as next time `model_user_mention` should return the existing mention record, - # that threw the `ActiveRecord::RecordNotUnique` exception in first place. - self.class.safe_ensure_unique(retries: 1) do # rubocop:disable Performance/ActiveRecordSubtransactionMethods - user_mention = model_user_mention - - # this may happen due to notes polymorphism, so noteable_id may point to a record - # that no longer exists as we cannot have FK on noteable_id - break if user_mention.blank? - - user_mention.mentioned_users_ids = references[:mentioned_users_ids] - user_mention.mentioned_groups_ids = references[:mentioned_groups_ids] - user_mention.mentioned_projects_ids = references[:mentioned_projects_ids] - - if user_mention.has_mentions? - user_mention.save! - else - user_mention.destroy! - end - end - - true - end - - def store_mentions_without_subtransaction! identifier = user_mention_identifier # this may happen due to notes polymorphism, so noteable_id may point to a record diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 4df9e32d8ec..a0ea5ac8012 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -217,17 +217,6 @@ module Mentionable def user_mention_association association(:user_mentions).reflection end - - # User mention that is parsed from model description rather then its related notes. - # Models that have a description attribute like Issue, MergeRequest, Epic, Snippet may have such a user mention. - # Other mentionable models like Commit, DesignManagement::Design, will never have such record as those do not have - # a description attribute. - # - # Using this method followed by a call to *save* may result in *ActiveRecord::RecordNotUnique* exception - # in a multi-threaded environment. Make sure to use it within a *safe_ensure_unique* block. - def model_user_mention - user_mentions.where(note_id: nil).first_or_initialize - end end Mentionable.prepend_mod_with('Mentionable') diff --git a/app/models/note.rb b/app/models/note.rb index 58a00fe6fa1..6c5bbf36bd6 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -606,14 +606,6 @@ class Note < ApplicationRecord private - # Using this method followed by a call to *save* may result in *ActiveRecord::RecordNotUnique* exception - # in a multi-threaded environment. Make sure to use it within a *safe_ensure_unique* block. - def model_user_mention - return if user_mentions.is_a?(ActiveRecord::NullRelation) - - user_mentions.first_or_initialize - end - def system_note_viewable_by?(user) return true unless system_note_metadata diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 5a7eb46771b..80b1db4abef 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -9,10 +9,6 @@ .page-title-holder.d-flex.align-items-center %h1.page-title= _('Issues') - - if current_user - .page-title-controls - = render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", with_feature_enabled: 'issues', type: :issues - .top-area = render 'shared/issuable/nav', type: :issues, display_count: !@no_filters_set .nav-controls diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index ae557b73620..25d5c063846 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -7,10 +7,6 @@ .page-title-holder.d-flex.align-items-start.flex-column.flex-sm-row.align-items-sm-center %h1.page-title= _('Merge requests') - - if current_user - .page-title-controls.ml-0.mb-3.ml-sm-auto.mb-sm-0 - = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", with_feature_enabled: 'merge_requests', type: :merge_requests - .top-area = render 'shared/issuable/nav', type: :merge_requests, display_count: !@no_filters_set diff --git a/app/views/dashboard/milestones/index.html.haml b/app/views/dashboard/milestones/index.html.haml index 872099f98fc..4a714b5a197 100644 --- a/app/views/dashboard/milestones/index.html.haml +++ b/app/views/dashboard/milestones/index.html.haml @@ -6,12 +6,6 @@ .page-title-holder.d-flex.align-items-center %h1.page-title= _('Milestones') - - if current_user - .page-title-controls - = render 'shared/new_project_item_select', - path: '-/milestones/new', label: 'New milestone', - include_groups: true, type: :milestones - .top-area = render 'shared/milestones_filter', counts: @milestone_states .nav-controls diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index fdd6962eb21..723ca5e70d2 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -13,8 +13,6 @@ - if @can_bulk_update = render_if_exists 'shared/issuable/bulk_update_button', type: :issues - = render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", type: :issues, with_feature_enabled: 'issues', with_shared: false, include_projects_in_subgroups: true - = render 'shared/issuable/search_bar', type: :issues - if @can_bulk_update diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index ad916e3aeec..9f7aa54395e 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -12,8 +12,6 @@ - if @can_bulk_update = render_if_exists 'shared/issuable/bulk_update_button', type: :merge_requests - = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", type: :merge_requests, with_feature_enabled: 'merge_requests', with_shared: false, include_projects_in_subgroups: true - = render 'shared/issuable/search_bar', type: :merge_requests - if @can_bulk_update diff --git a/app/views/profiles/notifications/_email_settings.html.haml b/app/views/profiles/notifications/_email_settings.html.haml index f452a5b2eb5..e1e4b2bf2d6 100644 --- a/app/views/profiles/notifications/_email_settings.html.haml +++ b/app/views/profiles/notifications/_email_settings.html.haml @@ -1,7 +1,7 @@ - form = local_assigns.fetch(:form) .form-group = form.label :notification_email, class: "label-bold" - = form.select :notification_email, @user.public_verified_emails, { include_blank: false }, class: "select2", disabled: local_assigns.fetch(:email_change_disabled, nil) + = form.select :notification_email, @user.public_verified_emails, { include_blank: _('Use primary email (%{email})') % { email: @user.email }, selected: @user.read_attribute(:notification_email) }, class: "select2", disabled: local_assigns.fetch(:email_change_disabled, nil) .help-block = local_assigns.fetch(:help_text, nil) .form-group diff --git a/config/feature_flags/development/store_mentions_without_subtransaction.yml b/config/feature_flags/development/store_mentions_without_subtransaction.yml deleted file mode 100644 index a71aa204935..00000000000 --- a/config/feature_flags/development/store_mentions_without_subtransaction.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: store_mentions_without_subtransaction -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68433 -rollout_issue_url: -milestone: '14.3' -type: development -group: group::project management -default_enabled: false diff --git a/db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb b/db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb new file mode 100644 index 00000000000..20118dbbac8 --- /dev/null +++ b/db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveSeatLinkEnabledFromApplicationSettings < ActiveRecord::Migration[6.1] + def up + remove_column :application_settings, :seat_link_enabled + end + + def down + add_column :application_settings, :seat_link_enabled, :boolean, null: false, default: true + end +end diff --git a/db/schema_migrations/20210721122840 b/db/schema_migrations/20210721122840 new file mode 100644 index 00000000000..375a03adc3d --- /dev/null +++ b/db/schema_migrations/20210721122840 @@ -0,0 +1 @@ +483ef6f8ef379f39ecff32853c777c12c59d2858f061879c375ff6d429396167
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index f3b1df2a322..81c336c62a8 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -9542,7 +9542,6 @@ CREATE TABLE application_settings ( email_restrictions_enabled boolean DEFAULT false NOT NULL, email_restrictions text, npm_package_requests_forwarding boolean DEFAULT true NOT NULL, - seat_link_enabled boolean DEFAULT true NOT NULL, container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL, issues_create_limit integer DEFAULT 0 NOT NULL, push_rule_id bigint, diff --git a/doc/development/database_debugging.md b/doc/development/database_debugging.md index 67ec1b3c4f1..e2cff82fcfc 100644 --- a/doc/development/database_debugging.md +++ b/doc/development/database_debugging.md @@ -25,6 +25,12 @@ If you just want to delete everything and start over with an empty DB (approxima bundle exec rake db:reset RAILS_ENV=development ``` +If you want to seed the empty DB with sample data (approximately 4 minutes): + +```shell +bundle exec rake dev:setup +``` + If you just want to delete everything and start over with sample data (approximately 4 minutes). This also does `db:reset` and runs DB-specific migrations: diff --git a/doc/user/profile/notifications.md b/doc/user/profile/notifications.md index 9d38c9df6be..cd4d4e370db 100644 --- a/doc/user/profile/notifications.md +++ b/doc/user/profile/notifications.md @@ -70,6 +70,7 @@ Your **Global notification settings** are the default settings unless you select different values for a project or a group. - **Notification email**: the email address your notifications are sent to. + Defaults to your primary email address. - **Receive product marketing emails**: select this checkbox to receive [periodic emails](#product-marketing-emails) about GitLab features. - **Global notification level**: the default [notification level](#notification-levels) diff --git a/lib/gitlab/ci/queue/metrics.rb b/lib/gitlab/ci/queue/metrics.rb index 859aeb35f26..7f45d626922 100644 --- a/lib/gitlab/ci/queue/metrics.rb +++ b/lib/gitlab/ci/queue/metrics.rb @@ -97,7 +97,9 @@ module Gitlab def observe_queue_size(size_proc, runner_type) return unless Feature.enabled?(:gitlab_ci_builds_queuing_metrics, default_enabled: false) - self.class.queue_size_total.observe({ runner_type: runner_type }, size_proc.call.to_f) + size = size_proc.call.to_f + self.class.queue_size_total.observe({ runner_type: runner_type }, size) + self.class.current_queue_size.set({ runner_type: runner_type }, size) end def observe_queue_time(metric, runner_type) @@ -199,6 +201,15 @@ module Gitlab end end + def self.current_queue_size + strong_memoize(:current_queue_size) do + name = :gitlab_ci_current_queue_size + comment = 'Current size of initialized CI/CD builds queue' + + Gitlab::Metrics.gauge(name, comment) + end + end + def self.queue_iteration_duration_seconds strong_memoize(:queue_iteration_duration_seconds) do name = :gitlab_ci_queue_iteration_duration_seconds diff --git a/lib/gitlab/metrics/instrumentation.rb b/lib/gitlab/metrics/instrumentation.rb index 66361529546..ad45a037161 100644 --- a/lib/gitlab/metrics/instrumentation.rb +++ b/lib/gitlab/metrics/instrumentation.rb @@ -153,6 +153,10 @@ module Gitlab method_visibility = method_visibility_for(target, name) + # We silence warnings to avoid such warnings: + # `Skipping set of ruby2_keywords flag for <...> + # (method accepts keywords or method does not accept argument splat)` + # as we apply ruby2_keywords 'blindly' for every instrumented method. proxy_module.class_eval <<-EOF, __FILE__, __LINE__ + 1 def #{name}(#{args_signature}) if trans = Gitlab::Metrics::Instrumentation.transaction @@ -162,6 +166,7 @@ module Gitlab super end end + silence_warnings { ruby2_keywords(:#{name}) if respond_to?(:ruby2_keywords, true) } #{method_visibility} :#{name} EOF diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 12a590d87e6..33ee854e7a9 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -36265,6 +36265,9 @@ msgstr "" msgid "Use one line per URI" msgstr "" +msgid "Use primary email (%{email})" +msgstr "" + msgid "Use shortcuts" msgstr "" diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 0b2811618b5..fa77dd03b09 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -46,38 +46,4 @@ RSpec.describe 'Dashboard Issues' do it_behaves_like "it has an RSS button with current_user's feed token" it_behaves_like "an autodiscoverable RSS feed with current_user's feed token" end - - describe 'new issue dropdown' do - it 'shows projects only with issues feature enabled', :js do - find('.new-project-item-select-button').click - - page.within('.select2-results') do - expect(page).to have_content(project.full_name) - expect(page).not_to have_content(project_with_issues_disabled.full_name) - end - end - - it 'shows the new issue page', :js do - find('.new-project-item-select-button').click - - wait_for_requests - - project_path = "/#{project.full_path}" - project_json = { name: project.full_name, url: project_path }.to_json - - # simulate selection, and prevent overlap by dropdown menu - first('.project-item-select', visible: false) - execute_script("$('.project-item-select').val('#{project_json}').trigger('change');") - find('#select2-drop-mask', visible: false) - execute_script("$('#select2-drop-mask').remove();") - - find('.new-project-item-link').click - - expect(page).to have_current_path("#{project_path}/-/issues/new") - - page.within('#content-body') do - expect(page).to have_selector('.issue-form') - end - end - end end diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index aa2485d4236..95e87933110 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -25,24 +25,6 @@ RSpec.describe 'Dashboard Merge Requests' do expect(page).not_to have_selector('#js-dropdown-target-branch', visible: false) end - context 'new merge request dropdown' do - let(:project_with_disabled_merge_requests) { create(:project, :merge_requests_disabled) } - - before do - project_with_disabled_merge_requests.add_maintainer(current_user) - visit merge_requests_dashboard_path - end - - it 'shows projects only with merge requests feature enabled', :js do - find('.new-project-item-select-button').click - - page.within('.select2-results') do - expect(page).to have_content(project.full_name) - expect(page).not_to have_content(project_with_disabled_merge_requests.full_name) - end - end - end - context 'no merge requests exist' do it 'shows an empty state' do visit merge_requests_dashboard_path(assignee_username: current_user.username) diff --git a/spec/features/dashboard/milestones_spec.rb b/spec/features/dashboard/milestones_spec.rb index 992ed2f2ce6..3f8d048efd6 100644 --- a/spec/features/dashboard/milestones_spec.rb +++ b/spec/features/dashboard/milestones_spec.rb @@ -32,20 +32,6 @@ RSpec.describe 'Dashboard > Milestones' do expect(page).to have_content(group.name) expect(first('.milestone')).to have_content('Merge requests') end - - describe 'new milestones dropdown', :js do - it 'takes user to a new milestone page', :js do - find('.new-project-item-select-button').click - - page.within('.select2-results') do - first('.select2-result-label').click - end - - find('.new-project-item-link').click - - expect(current_path).to eq(new_group_milestone_path(group)) - end - end end describe 'with merge requests disabled' do diff --git a/spec/features/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb index 4488f53a03f..092e6179732 100644 --- a/spec/features/groups/empty_states_spec.rb +++ b/spec/features/groups/empty_states_spec.rb @@ -92,20 +92,6 @@ RSpec.describe 'Group empty states' do it 'displays an empty state' do expect(page).to have_selector('.empty-state') end - - it "shows a new #{issuable_name} button" do - within '.empty-state' do - expect(page).to have_content("create #{issuable_name}") - end - end - - it "the new #{issuable_name} button opens a project dropdown" do - within '.empty-state' do - find('.new-project-item-select-button').click - end - - expect(page).to have_selector('.ajax-project-dropdown') - end end end diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index 21b39d2da46..6d04e3a227e 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -96,28 +96,6 @@ RSpec.describe 'Group issues page' do end end - context 'projects with issues disabled' do - describe 'issue dropdown' do - let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user } - - before do - [project, project_with_issues_disabled].each { |project| project.add_maintainer(user_in_group) } - sign_in(user_in_group) - visit issues_group_path(group) - end - - it 'shows projects only with issues feature enabled', :js do - find('.empty-state .js-lazy-loaded') - find('.empty-state .new-project-item-link').click - - page.within('.select2-results') do - expect(page).to have_content(project.full_name) - expect(page).not_to have_content(project_with_issues_disabled.full_name) - end - end - end - end - context 'manual ordering', :js do let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user } diff --git a/spec/features/groups/merge_requests_spec.rb b/spec/features/groups/merge_requests_spec.rb index 077f680629f..aad9be0ec8d 100644 --- a/spec/features/groups/merge_requests_spec.rb +++ b/spec/features/groups/merge_requests_spec.rb @@ -59,23 +59,6 @@ RSpec.describe 'Group merge requests page' do end end - describe 'new merge request dropdown' do - let(:project_with_merge_requests_disabled) { create(:project, :merge_requests_disabled, group: group) } - - before do - visit path - end - - it 'shows projects only with merge requests feature enabled', :js do - find('.new-project-item-link').click - - page.within('.select2-results') do - expect(page).to have_content(project.name_with_namespace) - expect(page).not_to have_content(project_with_merge_requests_disabled.name_with_namespace) - end - end - end - context 'empty state with no merge requests' do before do MergeRequest.delete_all @@ -85,7 +68,6 @@ RSpec.describe 'Group merge requests page' do visit path expect(page).to have_selector('.empty-state') - expect(page).to have_link('Select project to create merge request') expect(page).not_to have_selector('.issues-filters') end @@ -95,7 +77,6 @@ RSpec.describe 'Group merge requests page' do visit path expect(page).to have_selector('.empty-state') - expect(page).to have_link('Select project to create merge request') expect(page).to have_selector('.issues-filters') end end diff --git a/spec/frontend/ide/utils_spec.js b/spec/frontend/ide/utils_spec.js index 2f58cd8f22a..2f8447af518 100644 --- a/spec/frontend/ide/utils_spec.js +++ b/spec/frontend/ide/utils_spec.js @@ -90,6 +90,9 @@ describe('WebIDE utils', () => { it('returns true if there is a `binary` property already set on the file object', () => { expect(isTextFile({ name: 'abc.txt', content: '' })).toBe(true); expect(isTextFile({ name: 'abc.txt', content: '', binary: true })).toBe(false); + + expect(isTextFile({ name: 'abc.tex', content: 'éêė' })).toBe(false); + expect(isTextFile({ name: 'abc.tex', content: 'éêė', binary: false })).toBe(true); }); }); diff --git a/spec/support/shared_examples/models/mentionable_shared_examples.rb b/spec/support/shared_examples/models/mentionable_shared_examples.rb index 07c5f730e95..e23658d1774 100644 --- a/spec/support/shared_examples/models/mentionable_shared_examples.rb +++ b/spec/support/shared_examples/models/mentionable_shared_examples.rb @@ -207,7 +207,7 @@ RSpec.shared_examples 'an editable mentionable' do end RSpec.shared_examples 'mentions in description' do |mentionable_type| - shared_examples 'when storing user mentions' do + context 'when storing user mentions' do before do mentionable.store_mentions! end @@ -238,26 +238,10 @@ RSpec.shared_examples 'mentions in description' do |mentionable_type| end end end - - context 'when store_mentions_without_subtransaction is enabled' do - before do - stub_feature_flags(store_mentions_without_subtransaction: true) - end - - it_behaves_like 'when storing user mentions' - end - - context 'when store_mentions_without_subtransaction is disabled' do - before do - stub_feature_flags(store_mentions_without_subtransaction: false) - end - - it_behaves_like 'when storing user mentions' - end end RSpec.shared_examples 'mentions in notes' do |mentionable_type| - shared_examples 'when mentionable notes contain mentions' do + context 'when mentionable notes contain mentions' do let(:user) { create(:user) } let(:user2) { create(:user) } let(:group) { create(:group) } @@ -277,22 +261,6 @@ RSpec.shared_examples 'mentions in notes' do |mentionable_type| expect(mentionable.referenced_groups(user)).to eq [group] end end - - context 'when store_mentions_without_subtransaction is enabled' do - before do - stub_feature_flags(store_mentions_without_subtransaction: true) - end - - it_behaves_like 'when mentionable notes contain mentions' - end - - context 'when store_mentions_without_subtransaction is disabled' do - before do - stub_feature_flags(store_mentions_without_subtransaction: false) - end - - it_behaves_like 'when mentionable notes contain mentions' - end end RSpec.shared_examples 'load mentions from DB' do |mentionable_type| diff --git a/spec/views/profiles/notifications/show.html.haml_spec.rb b/spec/views/profiles/notifications/show.html.haml_spec.rb new file mode 100644 index 00000000000..9cdf8124fcf --- /dev/null +++ b/spec/views/profiles/notifications/show.html.haml_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'profiles/notifications/show' do + let(:groups) { GroupsFinder.new(user).execute.page(1) } + let(:user) { create(:user) } + + before do + assign(:group_notifications, []) + assign(:project_notifications, []) + assign(:user, user) + assign(:user_groups, groups) + allow(controller).to receive(:current_user).and_return(user) + allow(view).to receive(:experiment_enabled?) + end + + context 'when there is no database value for User#notification_email' do + let(:option_default) { _('Use primary email (%{email})') % { email: user.email } } + let(:option_primary_email) { user.email } + let(:options) { [option_default, option_primary_email] } + + it 'displays the correct elements' do + render + + expect(rendered).to have_select('user_notification_email', options: options, selected: nil) + end + end +end |