summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-27 09:09:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-27 09:09:51 +0000
commit39fa1b598749be0aad699032bbf31450b3ff0098 (patch)
tree15a4c28989d58f9315e58458a3a494ff8cfc1525 /app
parenta59d305223365cb31bb670f134383d6ff316a13e (diff)
downloadgitlab-ce-39fa1b598749be0aad699032bbf31450b3ff0098.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/refs_controller.rb4
-rw-r--r--app/helpers/blob_helper.rb21
-rw-r--r--app/models/internal_id_enums.rb13
-rw-r--r--app/models/issue.rb1
-rw-r--r--app/models/merge_request.rb1
-rw-r--r--app/models/sprint.rb13
-rw-r--r--app/views/projects/blob/_header.html.haml8
-rw-r--r--app/views/shared/file_hooks/_index.html.haml4
8 files changed, 49 insertions, 16 deletions
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index db0a17d8ee0..37f9bdc8fa4 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -11,6 +11,10 @@ class Projects::RefsController < Projects::ApplicationController
before_action :assign_ref_vars
before_action :authorize_download_code!
+ before_action only: [:logs_tree] do
+ push_frontend_feature_flag(:vue_file_list_lfs_badge)
+ end
+
def switch
respond_to do |format|
format.html do
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index 4debf66db64..69fe3303840 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -17,7 +17,7 @@ module BlobHelper
options[:link_opts])
end
- def ide_edit_path(project = @project, ref = @ref, path = @path, options = {})
+ def ide_edit_path(project = @project, ref = @ref, path = @path)
project_path =
if !current_user || can?(current_user, :push_code, project)
project.full_path
@@ -52,28 +52,25 @@ module BlobHelper
edit_button_tag(blob,
common_classes,
_('Edit'),
- Feature.enabled?(:web_ide_default) ? ide_edit_path(project, ref, path, options) : edit_blob_path(project, ref, path, options),
+ Feature.enabled?(:web_ide_default) ? ide_edit_path(project, ref, path) : edit_blob_path(project, ref, path, options),
project,
ref)
end
- def ide_edit_button(project = @project, ref = @ref, path = @path, options = {})
+ def ide_edit_button(project = @project, ref = @ref, path = @path, blob:)
return if Feature.enabled?(:web_ide_default)
- return unless blob = readable_blob(options, path, project, ref)
+ return unless blob
edit_button_tag(blob,
'btn btn-inverted btn-primary ide-edit-button ml-2',
_('Web IDE'),
- ide_edit_path(project, ref, path, options),
+ ide_edit_path(project, ref, path),
project,
ref)
end
- def modify_file_button(project = @project, ref = @ref, path = @path, label:, action:, btn_class:, modal_type:)
+ def modify_file_button(project = @project, ref = @ref, path = @path, blob:, label:, action:, btn_class:, modal_type:)
return unless current_user
-
- blob = project.repository.blob_at(ref, path) rescue nil
-
return unless blob
common_classes = "btn btn-#{btn_class}"
@@ -89,11 +86,12 @@ module BlobHelper
end
end
- def replace_blob_link(project = @project, ref = @ref, path = @path)
+ def replace_blob_link(project = @project, ref = @ref, path = @path, blob:)
modify_file_button(
project,
ref,
path,
+ blob: blob,
label: _("Replace"),
action: "replace",
btn_class: "default",
@@ -101,11 +99,12 @@ module BlobHelper
)
end
- def delete_blob_link(project = @project, ref = @ref, path = @path)
+ def delete_blob_link(project = @project, ref = @ref, path = @path, blob:)
modify_file_button(
project,
ref,
path,
+ blob: blob,
label: _("Delete"),
action: "delete",
btn_class: "default",
diff --git a/app/models/internal_id_enums.rb b/app/models/internal_id_enums.rb
index 84f450fc3a8..9dd6ee47d4a 100644
--- a/app/models/internal_id_enums.rb
+++ b/app/models/internal_id_enums.rb
@@ -3,7 +3,18 @@
module InternalIdEnums
def self.usage_resources
# when adding new resource, make sure it doesn't conflict with EE usage_resources
- { issues: 0, merge_requests: 1, deployments: 2, milestones: 3, epics: 4, ci_pipelines: 5, operations_feature_flags: 6, operations_user_lists: 7, alert_management_alerts: 8 }
+ {
+ issues: 0,
+ merge_requests: 1,
+ deployments: 2,
+ milestones: 3,
+ epics: 4,
+ ci_pipelines: 5,
+ operations_feature_flags: 6,
+ operations_user_lists: 7,
+ alert_management_alerts: 8,
+ sprints: 9
+ }
end
end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 7e038655269..7e303bc257a 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -31,6 +31,7 @@ class Issue < ApplicationRecord
belongs_to :project
belongs_to :duplicated_to, class_name: 'Issue'
belongs_to :closed_by, class_name: 'User'
+ belongs_to :sprint
belongs_to :moved_to, class_name: 'Issue'
has_one :moved_from, class_name: 'Issue', foreign_key: :moved_to_id
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 0010cd0fbdb..1564ba7c373 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -32,6 +32,7 @@ class MergeRequest < ApplicationRecord
belongs_to :target_project, class_name: "Project"
belongs_to :source_project, class_name: "Project"
belongs_to :merge_user, class_name: "User"
+ belongs_to :sprint
has_internal_id :iid, scope: :target_project, track_if: -> { !importing? }, init: ->(s) { s&.target_project&.merge_requests&.maximum(:iid) }
diff --git a/app/models/sprint.rb b/app/models/sprint.rb
index b2c6d9df010..10bf5c6ea16 100644
--- a/app/models/sprint.rb
+++ b/app/models/sprint.rb
@@ -1,6 +1,19 @@
# frozen_string_literal: true
class Sprint < ApplicationRecord
+ STATE_ID_MAP = {
+ active: 1,
+ closed: 2
+ }.with_indifferent_access.freeze
+
+ include AtomicInternalId
+
+ has_many :issues
+ has_many :merge_requests
+
belongs_to :project
belongs_to :group
+
+ has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.sprints&.maximum(:iid) }
+ has_internal_id :iid, scope: :group, init: ->(s) { s&.group&.sprints&.maximum(:iid) }
end
diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml
index 76a9d3df5d7..2a1545e7db7 100644
--- a/app/views/projects/blob/_header.html.haml
+++ b/app/views/projects/blob/_header.html.haml
@@ -4,13 +4,13 @@
.file-actions<
= render 'projects/blob/viewer_switcher', blob: blob unless blame
- = edit_blob_button
- = ide_edit_button
+ = edit_blob_button(@project, @ref, @path, blob: blob)
+ = ide_edit_button(@project, @ref, @path, blob: blob)
.btn-group.ml-2{ role: "group" }>
= render_if_exists 'projects/blob/header_file_locks_link'
- if current_user
- = replace_blob_link
- = delete_blob_link
+ = replace_blob_link(@project, @ref, @path, blob: blob)
+ = delete_blob_link(@project, @ref, @path, blob: blob)
.btn-group.ml-2{ role: "group" }
= copy_blob_source_button(blob) unless blame
= open_raw_blob_button(blob)
diff --git a/app/views/shared/file_hooks/_index.html.haml b/app/views/shared/file_hooks/_index.html.haml
index 74eb6c94116..0e1f41bbbf6 100644
--- a/app/views/shared/file_hooks/_index.html.haml
+++ b/app/views/shared/file_hooks/_index.html.haml
@@ -19,6 +19,10 @@
%li
.monospace
= File.basename(file)
+ - if File.dirname(file).ends_with?('plugins')
+ .text-warning
+ = _('Plugins directory is deprecated and will be removed in 14.0. Please move this file into /file_hooks directory.')
+
- else
.card.bg-light.text-center
.nothing-here-block= _('No file hooks found.')