summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-07-25 10:43:36 +0000
committerLin Jen-Shin <godfat@godfat.org>2016-07-25 10:43:36 +0000
commitfcb560f4bf5fdc606a962503bd2a061f138c162b (patch)
tree85cc23d000af4facae5a618ec5f764466dcf26c0 /app/controllers
parent2d9e7468de7edfe1868b8d9dc6dcdaff116f0da8 (diff)
parent83180110348af1b244d56e9cdf5f29c5d6f84db0 (diff)
downloadgitlab-ce-fcb560f4bf5fdc606a962503bd2a061f138c162b.tar.gz
Merge remote-tracking branch 'upstream/master' into artifacts-from-ref-and-build-name
* upstream/master: (117 commits) `WikiPage` should have a slug even when not persisted. ES6ify all the things! Make fork counter always clickable (!5463) Revert "Merge branch '17073-tagscontroller-index-is-terrible-response-time-goes-up-to-5-…" Fix CHANGELOG Add spec for dashes in paths Fix Error 500 when creating Wiki pages with hyphens or spaces Add links to the real markdown.md file for all GFM examples Remove magic comments from Ruby files (!5456) Ignore invalid trusted proxies in X-Forwarded-For header Fix bug where replies to commit notes displayed in the MR discussion tab wouldn't show up on the commit page Improve project rename log messages for better debugging If version file is unavailable unknown status Add gitlab-workhorse version to admin dashboard Add note to say GFM doesn't work on documentation website Add detailed info on storage path mountpoints Load project invited groups and members eagerly in ProjectTeam#fetch_members fix missing repo_ref param Add light border to rounded avatars Gracefully handle case when keep-around references are corrupted or exist already ...
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/application_settings_controller.rb6
-rw-r--r--app/controllers/help_controller.rb2
-rw-r--r--app/controllers/projects/commit_controller.rb4
-rw-r--r--app/controllers/projects/compare_controller.rb2
-rw-r--r--app/controllers/projects/merge_requests_controller.rb10
-rw-r--r--app/controllers/projects/notes_controller.rb65
-rw-r--r--app/controllers/projects/uploads_controller.rb8
7 files changed, 55 insertions, 42 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index 23ba83aba0e..9e1dc15de84 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -64,6 +64,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
params[:application_setting][:disabled_oauth_sign_in_sources] =
AuthHelper.button_based_providers.map(&:to_s) -
Array(enabled_oauth_sign_in_sources)
+ params.delete(:domain_blacklist_raw) if params[:domain_blacklist_file]
params.require(:application_setting).permit(
:default_projects_limit,
@@ -83,7 +84,10 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:default_project_visibility,
:default_snippet_visibility,
:default_group_visibility,
- :restricted_signup_domains_raw,
+ :domain_whitelist_raw,
+ :domain_blacklist_enabled,
+ :domain_blacklist_raw,
+ :domain_blacklist_file,
:version_check_enabled,
:admin_notification_email,
:user_oauth_applications,
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index d3dd98c8a4e..f7b44099b78 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -30,7 +30,7 @@ class HelpController < ApplicationController
end
# Allow access to images in the doc folder
- format.any(:png, :gif, :jpeg) do
+ format.any(:png, :gif, :jpeg, :mp4) do
# Note: We are purposefully NOT using `Rails.root.join`
path = File.join(Rails.root, 'doc', "#{@path}.#{params[:format]}")
diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb
index 727e84b40a1..7ae034f9398 100644
--- a/app/controllers/projects/commit_controller.rb
+++ b/app/controllers/projects/commit_controller.rb
@@ -115,11 +115,11 @@ class Projects::CommitController < Projects::ApplicationController
end
def define_note_vars
- @grouped_diff_notes = commit.notes.grouped_diff_notes
+ @grouped_diff_discussions = commit.notes.grouped_diff_discussions
@notes = commit.notes.non_diff_notes.fresh
Banzai::NoteRenderer.render(
- @grouped_diff_notes.values.flatten + @notes,
+ @grouped_diff_discussions.values.flat_map(&:notes) + @notes,
@project,
current_user,
)
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb
index 10749d0fef8..8c004724f02 100644
--- a/app/controllers/projects/compare_controller.rb
+++ b/app/controllers/projects/compare_controller.rb
@@ -54,7 +54,7 @@ class Projects::CompareController < Projects::ApplicationController
)
@diff_notes_disabled = true
- @grouped_diff_notes = {}
+ @grouped_diff_discussions = {}
end
end
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index df659bb8c3b..594a61464b9 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -97,7 +97,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
else
build_merge_request
@diff_notes_disabled = true
- @grouped_diff_notes = {}
+ @grouped_diff_discussions = {}
end
define_commit_vars
@@ -286,6 +286,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
status = pipeline.status
coverage = pipeline.try(:coverage)
+ status = "success_with_warnings" if pipeline.success? && pipeline.has_warnings?
+
status ||= "preparing"
else
ci_service = @merge_request.source_project.ci_service
@@ -376,7 +378,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
# This is not executed lazily
@notes = Banzai::NoteRenderer.render(
- @discussions.flatten,
+ @discussions.flat_map(&:notes),
@project,
current_user,
@path,
@@ -402,10 +404,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
}
@use_legacy_diff_notes = !@merge_request.support_new_diff_notes?
- @grouped_diff_notes = @merge_request.notes.grouped_diff_notes
+ @grouped_diff_discussions = @merge_request.notes.grouped_diff_discussions
Banzai::NoteRenderer.render(
- @grouped_diff_notes.values.flatten,
+ @grouped_diff_discussions.values.flat_map(&:notes),
@project,
current_user,
@path,
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 3eacdbbd067..766b7e9cf22 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -73,7 +73,7 @@ class Projects::NotesController < Projects::ApplicationController
end
alias_method :awardable, :note
- def note_to_html(note)
+ def note_html(note)
render_to_string(
"projects/notes/_note",
layout: false,
@@ -82,20 +82,20 @@ class Projects::NotesController < Projects::ApplicationController
)
end
- def note_to_discussion_html(note)
- return unless note.diff_note?
+ def diff_discussion_html(discussion)
+ return unless discussion.diff_discussion?
if params[:view] == 'parallel'
- template = "projects/notes/_diff_notes_with_reply_parallel"
+ template = "discussions/_parallel_diff_discussion"
locals =
if params[:line_type] == 'old'
- { notes_left: [note], notes_right: [] }
+ { discussion_left: discussion, discussion_right: nil }
else
- { notes_left: [], notes_right: [note] }
+ { discussion_left: nil, discussion_right: discussion }
end
else
- template = "projects/notes/_diff_notes_with_reply"
- locals = { notes: [note] }
+ template = "discussions/_diff_discussion"
+ locals = { discussion: discussion }
end
render_to_string(
@@ -106,14 +106,14 @@ class Projects::NotesController < Projects::ApplicationController
)
end
- def note_to_discussion_with_diff_html(note)
- return unless note.diff_note?
+ def discussion_html(discussion)
+ return unless discussion.diff_discussion?
render_to_string(
- "projects/notes/_discussion",
+ "discussions/_discussion",
layout: false,
formats: [:html],
- locals: { discussion_notes: [note] }
+ locals: { discussion: discussion }
)
end
@@ -132,26 +132,33 @@ class Projects::NotesController < Projects::ApplicationController
valid: true,
id: note.id,
discussion_id: note.discussion_id,
- html: note_to_html(note),
+ html: note_html(note),
award: false,
- note: note.note,
- discussion_html: note_to_discussion_html(note),
- discussion_with_diff_html: note_to_discussion_with_diff_html(note)
+ note: note.note
}
- # The discussion_id is used to add the comment to the correct discussion
- # element on the merge request page. Among other things, the discussion_id
- # contains the sha of head commit of the merge request.
- # When new commits are pushed into the merge request after the initial
- # load of the merge request page, the discussion elements will still have
- # the old discussion_ids, with the old head commit sha. The new comment,
- # however, will have the new discussion_id with the new commit sha.
- # To ensure that these new comments will still end up in the correct
- # discussion element, we also send the original discussion_id, with the
- # old commit sha, along, and fall back on this value when no discussion
- # element with the new discussion_id could be found.
- if note.new_diff_note? && note.position != note.original_position
- attrs[:original_discussion_id] = note.original_discussion_id
+ if note.diff_note?
+ discussion = Discussion.new([note])
+
+ attrs.merge!(
+ diff_discussion_html: diff_discussion_html(discussion),
+ discussion_html: discussion_html(discussion)
+ )
+
+ # The discussion_id is used to add the comment to the correct discussion
+ # element on the merge request page. Among other things, the discussion_id
+ # contains the sha of head commit of the merge request.
+ # When new commits are pushed into the merge request after the initial
+ # load of the merge request page, the discussion elements will still have
+ # the old discussion_ids, with the old head commit sha. The new comment,
+ # however, will have the new discussion_id with the new commit sha.
+ # To ensure that these new comments will still end up in the correct
+ # discussion element, we also send the original discussion_id, with the
+ # old commit sha, along, and fall back on this value when no discussion
+ # element with the new discussion_id could be found.
+ if note.new_diff_note? && note.position != note.original_position
+ attrs[:original_discussion_id] = note.original_discussion_id
+ end
end
attrs
diff --git a/app/controllers/projects/uploads_controller.rb b/app/controllers/projects/uploads_controller.rb
index caed064dfbc..e617be8f9fb 100644
--- a/app/controllers/projects/uploads_controller.rb
+++ b/app/controllers/projects/uploads_controller.rb
@@ -1,6 +1,6 @@
class Projects::UploadsController < Projects::ApplicationController
skip_before_action :reject_blocked!, :project,
- :repository, if: -> { action_name == 'show' && image? }
+ :repository, if: -> { action_name == 'show' && image_or_video? }
before_action :authorize_upload_file!, only: [:create]
@@ -24,7 +24,7 @@ class Projects::UploadsController < Projects::ApplicationController
def show
return render_404 if uploader.nil? || !uploader.file.exists?
- disposition = uploader.image? ? 'inline' : 'attachment'
+ disposition = uploader.image_or_video? ? 'inline' : 'attachment'
send_file uploader.file.path, disposition: disposition
end
@@ -49,7 +49,7 @@ class Projects::UploadsController < Projects::ApplicationController
@uploader
end
- def image?
- uploader && uploader.file.exists? && uploader.image?
+ def image_or_video?
+ uploader && uploader.file.exists? && uploader.image_or_video?
end
end