diff options
22 files changed, 311 insertions, 188 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index aa3b4ca33b9..f3a264d1f2f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -470,8 +470,10 @@ Rails/TimeZone: Include: - 'app/controllers/**/*' - 'app/services/**/*' + - 'lib/**/*' - 'spec/controllers/**/*' - 'spec/services/**/*' + - 'spec/lib/**/*' - 'ee/app/controllers/**/*' - 'ee/app/services/**/*' - 'ee/spec/controllers/**/*' @@ -484,7 +486,8 @@ Rails/TimeZone: - 'spec/workers/**/*' - 'ee/app/workers/**/*' - 'ee/spec/workers/**/*' - + - 'ee/lib/**/*' + - 'ee/spec/lib/**/*' # WIP: See https://gitlab.com/gitlab-org/gitlab/-/issues/220040 Rails/SaveBang: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b1eb0e59e77..f020e0af588 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2020-05-20 16:32:14 -0400 using RuboCop version 0.82.0. +# `rubocop --auto-gen-config --exclude-limit 10000` +# on 2020-08-17 21:05:54 +1200 using RuboCop version 0.82.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -448,6 +448,166 @@ Rails/RakeEnvironment: Rails/SkipsModelValidations: Enabled: false +# Offense count: 308 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: strict, flexible +Rails/TimeZone: + Enabled: true + Exclude: + - 'lib/gitlab/popen.rb' + - 'ee/lib/delay.rb' + - 'ee/lib/gitlab/elastic/helper.rb' + - 'ee/lib/gitlab/elastic/indexer.rb' + - 'ee/lib/gitlab/geo/base_request.rb' + - 'ee/lib/gitlab/geo/event_gap_tracking.rb' + - 'ee/lib/gitlab/geo/log_cursor/events/design_repository_updated_event.rb' + - 'ee/lib/gitlab/geo/log_cursor/events/repository_updated_event.rb' + - 'ee/lib/gitlab/geo/log_cursor/logger.rb' + - 'ee/lib/gitlab/geo/oauth/login_state.rb' + - 'ee/lib/gitlab/prometheus/queries/cluster_query.rb' + - 'ee/lib/gitlab/prometheus/queries/packet_flow_query.rb' + - 'ee/spec/lib/ee/gitlab/checks/push_rules/commit_check_spec.rb' + - 'ee/spec/lib/ee/gitlab/ci/pipeline/quota/job_activity_spec.rb' + - 'ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb' + - 'ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_summary_spec.rb' + - 'ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_time_summary_spec.rb' + - 'ee/spec/lib/gitlab/auth/ldap/access_spec.rb' + - 'ee/spec/lib/gitlab/auth/smartcard/san_extension_spec.rb' + - 'ee/spec/lib/gitlab/auth/smartcard/session_spec.rb' + - 'ee/spec/lib/gitlab/background_migration/fix_orphan_promoted_issues_spec.rb' + - 'ee/spec/lib/gitlab/ci/pipeline/chain/limit/job_activity_spec.rb' + - 'ee/spec/lib/gitlab/elastic/client_spec.rb' + - 'ee/spec/lib/gitlab/geo/base_request_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/cache_invalidation_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/container_repository_updated_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/design_repository_updated_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/hashed_storage_attachments_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/hashed_storage_migrated_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/job_artifact_deleted_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/lfs_object_deleted_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/repositories_changed_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_created_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_deleted_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_renamed_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/reset_checksum_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/events/upload_deleted_event_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb' + - 'ee/spec/lib/gitlab/git_access_spec.rb' + - 'ee/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb' + - 'ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb' + - 'ee/spec/lib/gitlab/prometheus/queries/packet_flow_query_spec.rb' + - 'lib/api/helpers.rb' + - 'lib/api/sidekiq_metrics.rb' + - 'lib/backup/manager.rb' + - 'lib/bitbucket_server/representation/base.rb' + - 'lib/gitlab/auth/current_user_mode.rb' + - 'lib/gitlab/auth/ldap/access.rb' + - 'lib/gitlab/chaos.rb' + - 'lib/gitlab/checks/timed_logger.rb' + - 'lib/gitlab/ci/ansi2json/line.rb' + - 'lib/gitlab/ci/pipeline/chain/sequence.rb' + - 'lib/gitlab/ci/pipeline/duration.rb' + - 'lib/gitlab/cycle_analytics/summary/deployment_frequency.rb' + - 'lib/gitlab/database.rb' + - 'lib/gitlab/external_authorization/access.rb' + - 'lib/gitlab/external_authorization/cache.rb' + - 'lib/gitlab/gitaly_client.rb' + - 'lib/gitlab/gitaly_client/ref_service.rb' + - 'lib/gitlab/github_import/representation.rb' + - 'lib/gitlab/grape_logging/loggers/queue_duration_logger.rb' + - 'lib/gitlab/health_checks/base_abstract_check.rb' + - 'lib/gitlab/import_export.rb' + - 'lib/gitlab/instrumentation/elasticsearch_transport.rb' + - 'lib/gitlab/instrumentation/redis_interceptor.rb' + - 'lib/gitlab/instrumentation_helper.rb' + - 'lib/gitlab/kubernetes/helm/certificate.rb' + - 'lib/gitlab/lfs_token.rb' + - 'lib/gitlab/loop_helpers.rb' + - 'lib/gitlab/phabricator_import/representation/task.rb' + - 'lib/gitlab/prometheus/queries/additional_metrics_environment_query.rb' + - 'lib/gitlab/prometheus/queries/matched_metric_query.rb' + - 'lib/gitlab/prometheus_client.rb' + - 'lib/gitlab/sherlock/transaction.rb' + - 'lib/gitlab/task_helpers.rb' + - 'lib/gitlab/x509/tag.rb' + - 'lib/grafana/time_window.rb' + - 'lib/json_web_token/token.rb' + - 'lib/object_storage/direct_upload.rb' + - 'lib/quality/seeders/issues.rb' + - 'lib/rspec_flaky/flaky_example.rb' + - 'lib/rspec_flaky/report.rb' + - 'lib/tasks/gitlab/assets.rake' + - 'lib/tasks/gitlab/backup.rake' + - 'lib/tasks/gitlab/cleanup.rake' + - 'lib/tasks/gitlab/list_repos.rake' + - 'spec/lib/api/helpers_spec.rb' + - 'spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb' + - 'spec/lib/gitlab/app_json_logger_spec.rb' + - 'spec/lib/gitlab/app_text_logger_spec.rb' + - 'spec/lib/gitlab/auth/current_user_mode_spec.rb' + - 'spec/lib/gitlab/background_migration/recalculate_project_authorizations_spec.rb' + - 'spec/lib/gitlab/background_migration/wrongfully_confirmed_email_unconfirmer_spec.rb' + - 'spec/lib/gitlab/bitbucket_import/importer_spec.rb' + - 'spec/lib/gitlab/bitbucket_server_import/importer_spec.rb' + - 'spec/lib/gitlab/checks/timed_logger_spec.rb' + - 'spec/lib/gitlab/ci/cron_parser_spec.rb' + - 'spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb' + - 'spec/lib/gitlab/cycle_analytics/usage_data_spec.rb' + - 'spec/lib/gitlab/data_builder/note_spec.rb' + - 'spec/lib/gitlab/database/background_migration_job_spec.rb' + - 'spec/lib/gitlab/database_spec.rb' + - 'spec/lib/gitlab/discussions_diff/file_collection_spec.rb' + - 'spec/lib/gitlab/external_authorization/access_spec.rb' + - 'spec/lib/gitlab/external_authorization/cache_spec.rb' + - 'spec/lib/gitlab/external_authorization/logger_spec.rb' + - 'spec/lib/gitlab/fogbugz_import/importer_spec.rb' + - 'spec/lib/gitlab/git/branch_spec.rb' + - 'spec/lib/gitlab/git/commit_spec.rb' + - 'spec/lib/gitlab/git/repository_spec.rb' + - 'spec/lib/gitlab/git_access_spec.rb' + - 'spec/lib/gitlab/github_import/importer/diff_note_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/issue_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/issues_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/milestones_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/note_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/releases_importer_spec.rb' + - 'spec/lib/gitlab/github_import/representation/diff_note_spec.rb' + - 'spec/lib/gitlab/github_import/representation/issue_spec.rb' + - 'spec/lib/gitlab/github_import/representation/note_spec.rb' + - 'spec/lib/gitlab/github_import/representation/pull_request_spec.rb' + - 'spec/lib/gitlab/grape_logging/formatters/lograge_with_timestamp_spec.rb' + - 'spec/lib/gitlab/grape_logging/loggers/cloudflare_logger_spec.rb' + - 'spec/lib/gitlab/grape_logging/loggers/queue_duration_logger_spec.rb' + - 'spec/lib/gitlab/graphql_logger_spec.rb' + - 'spec/lib/gitlab/graphs/commits_spec.rb' + - 'spec/lib/gitlab/import_export/project/relation_factory_spec.rb' + - 'spec/lib/gitlab/instrumentation_helper_spec.rb' + - 'spec/lib/gitlab/json_logger_spec.rb' + - 'spec/lib/gitlab/lfs_token_spec.rb' + - 'spec/lib/gitlab/log_timestamp_formatter_spec.rb' + - 'spec/lib/gitlab/middleware/rails_queue_duration_spec.rb' + - 'spec/lib/gitlab/omniauth_logging/json_formatter_spec.rb' + - 'spec/lib/gitlab/phabricator_import/issues/task_importer_spec.rb' + - 'spec/lib/gitlab/phabricator_import/representation/task_spec.rb' + - 'spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb' + - 'spec/lib/gitlab/prometheus/queries/deployment_query_spec.rb' + - 'spec/lib/gitlab/prometheus/queries/validate_query_spec.rb' + - 'spec/lib/gitlab/sherlock/transaction_spec.rb' + - 'spec/lib/gitlab/sidekiq_logging/json_formatter_spec.rb' + - 'spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing_spec.rb' + - 'spec/lib/gitlab/updated_notes_paginator_spec.rb' + - 'spec/lib/gitlab/utils/json_size_estimator_spec.rb' + - 'spec/lib/gitlab/x509/signature_spec.rb' + - 'spec/lib/grafana/time_window_spec.rb' + - 'spec/lib/json_web_token/hmac_token_spec.rb' + - 'spec/lib/rspec_flaky/flaky_example_spec.rb' + - 'spec/lib/rspec_flaky/listener_spec.rb' + - 'spec/lib/rspec_flaky/report_spec.rb' + # Offense count: 8 # Cop supports --auto-correct. Security/YAMLLoad: diff --git a/app/assets/javascripts/boards/components/board_content.vue b/app/assets/javascripts/boards/components/board_content.vue index b8a78cb8834..c42295792f1 100644 --- a/app/assets/javascripts/boards/components/board_content.vue +++ b/app/assets/javascripts/boards/components/board_content.vue @@ -1,19 +1,61 @@ <script> -import BoardContentLayout from '~/boards/components/board_content_layout.vue'; -import BoardColumn from '~/boards/components/board_column.vue'; +import { mapState } from 'vuex'; +import BoardColumn from 'ee_else_ce/boards/components/board_column.vue'; +import EpicsSwimlanes from 'ee_component/boards/components/epics_swimlanes.vue'; +import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; export default { components: { - BoardContentLayout, BoardColumn, + EpicsSwimlanes, + }, + mixins: [glFeatureFlagMixin()], + props: { + lists: { + type: Array, + required: true, + }, + canAdminList: { + type: Boolean, + required: true, + }, + groupId: { + type: Number, + required: false, + default: null, + }, + disabled: { + type: Boolean, + required: true, + }, + issueLinkBase: { + type: String, + required: true, + }, + rootPath: { + type: String, + required: true, + }, + boardId: { + type: String, + required: true, + }, + }, + computed: { + ...mapState(['isShowingEpicsSwimlanes', 'boardLists']), + isSwimlanesOn() { + return this.glFeatures.boardsWithSwimlanes && this.isShowingEpicsSwimlanes; + }, }, }; </script> <template> - <board-content-layout v-bind="$attrs"> - <template - #board-content-decoration="{ lists, canAdminList, groupId, disabled, issueLinkBase, rootPath, boardId }" + <div> + <div + v-if="!isSwimlanesOn" + class="boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap" + data-qa-selector="boards_list" > <board-column v-for="list in lists" @@ -27,6 +69,16 @@ export default { :root-path="rootPath" :board-id="boardId" /> - </template> - </board-content-layout> + </div> + <epics-swimlanes + v-else + ref="swimlanes" + :lists="boardLists" + :can-admin-list="canAdminList" + :disabled="disabled" + :board-id="boardId" + :group-id="groupId" + :root-path="rootPath" + /> + </div> </template> diff --git a/app/assets/javascripts/boards/components/board_content_layout.vue b/app/assets/javascripts/boards/components/board_content_layout.vue deleted file mode 100644 index 03b2597f6aa..00000000000 --- a/app/assets/javascripts/boards/components/board_content_layout.vue +++ /dev/null @@ -1,50 +0,0 @@ -<script> -export default { - props: { - lists: { - type: Array, - required: true, - }, - canAdminList: { - type: Boolean, - required: true, - }, - groupId: { - type: Number, - required: false, - default: null, - }, - disabled: { - type: Boolean, - required: true, - }, - issueLinkBase: { - type: String, - required: true, - }, - rootPath: { - type: String, - required: true, - }, - boardId: { - type: String, - required: true, - }, - isSwimlanesOff: { - type: Boolean, - required: false, - default: false, - }, - }, -}; -</script> - -<template> - <div - :class="{ 'boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap': isSwimlanesOff }" - data-qa-selector="boards_list" - data-testid="boards_list" - > - <slot name="board-content-decoration" v-bind="$props"></slot> - </div> -</template> diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index 74b27a1f2b3..94865516fc4 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -4,7 +4,6 @@ import { mapActions } from 'vuex'; import 'ee_else_ce/boards/models/issue'; import 'ee_else_ce/boards/models/list'; -import BoardContent from 'ee_else_ce/boards/components/board_content.vue'; import BoardSidebar from 'ee_else_ce/boards/components/board_sidebar'; import initNewListDropdown from 'ee_else_ce/boards/components/new_list_dropdown'; import boardConfigToggle from 'ee_else_ce/boards/config_toggle'; @@ -19,6 +18,7 @@ import { } from 'ee_else_ce/boards/ee_functions'; import VueApollo from 'vue-apollo'; +import BoardContent from '~/boards/components/board_content.vue'; import createDefaultClient from '~/lib/graphql'; import Flash from '~/flash'; import { __ } from '~/locale'; diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index dd7a6d64e7b..2ba1d841c2e 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -57,12 +57,14 @@ module NotesHelper def add_diff_note_button(line_code, position, line_type) return if @diff_notes_disabled - button_tag '', - class: 'add-diff-note js-add-diff-note-button', - type: 'submit', name: 'button', - data: diff_view_line_data(line_code, position, line_type), - title: _('Add a comment to this line') do - sprite_icon('comment', size: 12) + content_tag(:span, class: 'add-diff-note tooltip-wrapper') do + button_tag '', + class: 'note-button add-diff-note js-add-diff-note-button', + type: 'submit', name: 'button', + data: diff_view_line_data(line_code, position, line_type), + title: _('Add a comment to this line') do + sprite_icon('comment', size: 12) + end end end diff --git a/changelogs/unreleased/sh-fix-time-zones.yml b/changelogs/unreleased/sh-fix-time-zones.yml new file mode 100644 index 00000000000..5de9241f1fc --- /dev/null +++ b/changelogs/unreleased/sh-fix-time-zones.yml @@ -0,0 +1,5 @@ +--- +title: Fix time zone config not respected in multi-threaded servers +merge_request: 39778 +author: +type: fixed diff --git a/config/initializers/time_zone.rb b/config/initializers/time_zone.rb index ee246e67d66..bca7411ad63 100644 --- a/config/initializers/time_zone.rb +++ b/config/initializers/time_zone.rb @@ -1 +1,8 @@ Time.zone = Gitlab.config.gitlab.time_zone || Time.zone +# The default is normally set by Rails in the +# active_support.initialize_time_zone Railtie, but we need to set it +# here because the config settings aren't available until after that +# runs. We set the default to ensure multi-threaded servers have the +# right value. +Time.zone_default = Time.zone +Rails.application.config.time_zone = Time.zone diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index a285ce96ae5..b0d04a2f48d 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -7807,6 +7807,16 @@ type Iteration { iid: ID! """ + Web path of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts + """ + scopedPath: String + + """ + Web URL of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts + """ + scopedUrl: String + + """ Timestamp of the iteration start date """ startDate: Time diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index 3733f33d308..a332c218a84 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -21512,6 +21512,34 @@ "deprecationReason": null }, { + "name": "scopedPath", + "description": "Web path of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "scopedUrl", + "description": "Web URL of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "startDate", "description": "Timestamp of the iteration start date", "args": [ diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 738258ac7b4..21aba30d90f 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -1191,6 +1191,8 @@ Represents an iteration object. | `dueDate` | Time | Timestamp of the iteration due date | | `id` | ID! | ID of the iteration | | `iid` | ID! | Internal ID of the iteration | +| `scopedPath` | String | Web path of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts | +| `scopedUrl` | String | Web URL of the iteration, scoped to the query parent. Only valid for Project parents. Returns null in other contexts | | `startDate` | Time | Timestamp of the iteration start date | | `state` | IterationState! | State of the iteration | | `title` | String! | Title of the iteration | diff --git a/doc/development/telemetry/snowplow.md b/doc/development/telemetry/snowplow.md index 77346b89cac..547ba36464b 100644 --- a/doc/development/telemetry/snowplow.md +++ b/doc/development/telemetry/snowplow.md @@ -305,12 +305,16 @@ We use the [AsyncEmitter](https://github.com/snowplow/snowplow/wiki/Ruby-Tracker There are several tools for developing and testing Snowplow Event -| Testing Tool | Frontend Tracking | Backend Tracking | Local Development Environment | Production Environment | -|----------------------------------------------|--------------------|---------------------|-------------------------------|------------------------| -| Snowplow Analytics Debugger Chrome Extension | **{check-circle}** | **{dotted-circle}** | **{check-circle}** | **{check-circle}** | -| Snowplow Inspector Chrome Extension | **{check-circle}** | **{dotted-circle}** | **{check-circle}** | **{check-circle}** | -| Snowplow Micro | **{check-circle}** | **{check-circle}** | **{check-circle}** | **{dotted-circle}** | -| Snowplow Mini | **{check-circle}** | **{check-circle}** | **{dotted-circle}** | **{check-circle}** | +| Testing Tool | Frontend Tracking | Backend Tracking | Local Development Environment | Production Environment | Production Environment | +|----------------------------------------------|--------------------|---------------------|-------------------------------|------------------------|------------------------| +| Snowplow Analytics Debugger Chrome Extension | **{check-circle}** | **{dotted-circle}** | **{check-circle}** | **{check-circle}** | **{check-circle}** | +| Snowplow Inspector Chrome Extension | **{check-circle}** | **{dotted-circle}** | **{check-circle}** | **{check-circle}** | **{check-circle}** | +| Snowplow Micro | **{check-circle}** | **{check-circle}** | **{check-circle}** | **{dotted-circle}** | **{dotted-circle}** | +| Snowplow Mini | **{check-circle}** | **{check-circle}** | **{dotted-circle}** | **{status_preparing}** | **{status_preparing}** | + +**Legend** + +**{check-circle}** Available, **{status_preparing}** In progress, **{dotted-circle}** Not Planned ### Snowplow Analytics Debugger Chrome Extension diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 8a4da67de4d..1694a967f26 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -55,7 +55,7 @@ module API desc: 'Return issues ordered by `created_at` or `updated_at` fields.' optional :sort, type: String, values: %w[asc desc], default: 'desc', desc: 'Return issues sorted in `asc` or `desc` order.' - optional :due_date, type: String, values: %w[0 overdue week month next_month_and_previous_two_weeks], + optional :due_date, type: String, values: %w[0 overdue week month next_month_and_previous_two_weeks] << '', desc: 'Return issues that have no due date (`0`), or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`, `0`' use :issues_stats_params diff --git a/lib/api/users.rb b/lib/api/users.rb index 7942777287b..335624963aa 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -218,7 +218,7 @@ module API user_params = declared_params(include_missing: false) - user_params[:password_expires_at] = Time.now if user_params[:password].present? + user_params[:password_expires_at] = Time.current if user_params[:password].present? result = ::Users::UpdateService.new(current_user, user_params.merge(user: user)).execute if result[:status] == :success diff --git a/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb b/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb index cd947b15154..768c8bb4cbb 100644 --- a/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb +++ b/lib/gitlab/incident_management/pager_duty/incident_issue_description.rb @@ -32,7 +32,7 @@ module Gitlab end def incident_created_at - Time.parse(incident_payload['created_at']) + Time.zone.parse(incident_payload['created_at']) rescue Time.current.utc # PagerDuty provides time in UTC end diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index f6914389637..73a80155dbc 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -58,7 +58,7 @@ module Gitlab end def recorded_at - Time.now + Time.current end # rubocop: disable Metrics/AbcSize diff --git a/lib/gitlab/utils/usage_data.rb b/lib/gitlab/utils/usage_data.rb index 625e1076a54..36046ca14bf 100644 --- a/lib/gitlab/utils/usage_data.rb +++ b/lib/gitlab/utils/usage_data.rb @@ -93,7 +93,7 @@ module Gitlab end def with_finished_at(key, &block) - yield.merge(key => Time.now) + yield.merge(key => Time.current) end private diff --git a/spec/frontend/boards/components/board_content_layout_spec.js b/spec/frontend/boards/components/board_content_layout_spec.js deleted file mode 100644 index b6e260de8dd..00000000000 --- a/spec/frontend/boards/components/board_content_layout_spec.js +++ /dev/null @@ -1,66 +0,0 @@ -import { mount } from '@vue/test-utils'; -import BoardContentLayout from '~/boards/components/board_content_layout.vue'; - -const TestComponent = { - components: { BoardContentLayout }, - template: ` - <div> - <board-content-layout v-bind="$attrs"> - <template v-slot:board-content-decoration="{ groupId }"> - <p data-testid="child">{{ groupId }}</p> - </template> - </board-content-layout> - </div> - `, -}; - -describe('BoardContentLayout', () => { - let wrapper; - const groupId = 1; - - const createComponent = props => { - wrapper = mount(TestComponent, { - propsData: { - lists: [], - canAdminList: true, - groupId, - disabled: false, - issueLinkBase: '', - rootPath: '', - boardId: '', - ...props, - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - - it('renders children in the slot', () => { - createComponent(); - - expect(wrapper.find('[data-testid="child"]').exists()).toBe(true); - }); - - it('renders groupId from the scoped slot', () => { - createComponent(); - - expect(wrapper.find('[data-testid="child"]').text()).toContain(groupId); - }); - - describe('when isSwimlanesOff', () => { - it('renders the correct class on the root div', () => { - createComponent({ isSwimlanesOff: true }); - - expect(wrapper.find('[data-testid="boards_list"]').classes()).toEqual([ - 'boards-list', - 'gl-w-full', - 'gl-py-5', - 'gl-px-3', - 'gl-white-space-nowrap', - ]); - }); - }); -}); diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js deleted file mode 100644 index 5f8d34aa519..00000000000 --- a/spec/frontend/boards/components/board_content_spec.js +++ /dev/null @@ -1,40 +0,0 @@ -import { mount } from '@vue/test-utils'; -import axios from 'axios'; -import MockAdapter from 'axios-mock-adapter'; -import BoardContent from '~/boards/components/board_content.vue'; -import BoardColumn from '~/boards/components/board_column.vue'; -import List from '~/boards/models/list'; -import { listObj } from '../mock_data'; - -describe('BoardContent', () => { - let wrapper; - let mock; - - const createComponent = () => { - wrapper = mount(BoardContent, { - propsData: { - lists: [new List(listObj)], - canAdminList: true, - groupId: 1, - disabled: false, - issueLinkBase: '', - rootPath: '', - boardId: '', - }, - }); - }; - - beforeEach(() => { - mock = new MockAdapter(axios); - }); - - afterEach(() => { - mock.restore(); - }); - - it('finds BoardColumns', () => { - createComponent(); - - expect(wrapper.findAll(BoardColumn).length).toBe(1); - }); -}); diff --git a/spec/lib/gitlab/alerting/alert_spec.rb b/spec/lib/gitlab/alerting/alert_spec.rb index 9663e6af0d2..b53b71e3f3e 100644 --- a/spec/lib/gitlab/alerting/alert_spec.rb +++ b/spec/lib/gitlab/alerting/alert_spec.rb @@ -191,7 +191,7 @@ RSpec.describe Gitlab::Alerting::Alert do end context 'with payload' do - let(:time) { Time.now.change(usec: 0) } + let(:time) { Time.current.change(usec: 0) } before do payload['startsAt'] = time.rfc3339 @@ -274,7 +274,7 @@ RSpec.describe Gitlab::Alerting::Alert do before do payload.update( 'annotations' => { 'title' => 'some title' }, - 'startsAt' => Time.now.rfc3339 + 'startsAt' => Time.current.rfc3339 ) end diff --git a/spec/lib/gitlab/utils/usage_data_spec.rb b/spec/lib/gitlab/utils/usage_data_spec.rb index 7940c9af6ff..4675cbd7fa1 100644 --- a/spec/lib/gitlab/utils/usage_data_spec.rb +++ b/spec/lib/gitlab/utils/usage_data_spec.rb @@ -122,7 +122,7 @@ RSpec.describe Gitlab::Utils::UsageData do freeze_time do result = described_class.with_finished_at(:current_time) { { a: 1 } } - expect(result).to eq(a: 1, current_time: Time.now) + expect(result).to eq(a: 1, current_time: Time.current) end end end diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb index 5cd8a0ea203..b638a65d65e 100644 --- a/spec/requests/api/issues/issues_spec.rb +++ b/spec/requests/api/issues/issues_spec.rb @@ -404,6 +404,12 @@ RSpec.describe API::Issues do travel_back end + it 'returns them all when argument is empty' do + get api('/issues?due_date=', user) + + expect_paginated_array_response(issue5.id, issue4.id, issue3.id, issue2.id, issue.id, closed_issue.id) + end + it 'returns issues without due date' do get api('/issues?due_date=0', user) |