Commit 7e8fe9a6 authored by Ciro Santilli's avatar Ciro Santilli
Browse files

Append in place for strings and arrays

parent 1d67cc4403ee
......@@ -41,9 +41,9 @@
@path = params[:path]
contents = []
contents += tree.trees
contents += tree.blobs
contents += tree.submodules
contents.push(*tree.trees)
contents.push(*tree.blobs)
contents.push(*tree.submodules)
@logs = contents[@offset, @limit].to_a.map do |content|
file = @path ? File.join(@path, content.name) : content.name
......
......@@ -44,7 +44,7 @@
parts = @path.split('/')
parts.each_with_index do |part, i|
crumbs += content_tag(:li) do
crumbs << content_tag(:li) do
# The text is just the individual part, but the link needs all the parts before it
link_to part, project_commits_path(@project, tree_join(@ref, parts[0..i].join('/')))
end
......
module GraphHelper
def get_refs(repo, commit)
refs = ""
refs += commit.ref_names(repo).join(" ")
refs << commit.ref_names(repo).join(' ')
# append note count
......@@ -5,6 +5,6 @@
# append note count
refs += "[#{@graph.notes[commit.id]}]" if @graph.notes[commit.id] > 0
refs << "[#{@graph.notes[commit.id]}]" if @graph.notes[commit.id] > 0
refs
end
......
......@@ -86,7 +86,7 @@
def link_to_toggle_star(title, starred, signed_in)
cls = 'star-btn'
cls += ' disabled' unless signed_in
cls << ' disabled' unless signed_in
toggle_html = content_tag('span', class: 'toggle') do
toggle_text = if starred
......
......@@ -6,7 +6,7 @@
def tag_list(project)
html = ''
project.tag_list.each do |tag|
html += link_to tag, tag_path(tag)
html << link_to(tag, tag_path(tag))
end
html.html_safe
......
......@@ -10,6 +10,7 @@
tree = ""
# Render folders if we have any
tree += render partial: 'projects/tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
tree << render(partial: 'projects/tree/tree_item', collection: folders,
locals: { type: 'folder' }) if folders.present?
# Render files if we have any
......@@ -14,5 +15,6 @@
# Render files if we have any
tree += render partial: 'projects/tree/blob_item', collection: files, locals: {type: 'file'} if files.present?
tree << render(partial: 'projects/tree/blob_item', collection: files,
locals: { type: 'file' }) if files.present?
# Render submodules if we have any
......@@ -17,6 +19,7 @@
# Render submodules if we have any
tree += render partial: 'projects/tree/submodule_item', collection: submodules if submodules.present?
tree << render(partial: 'projects/tree/submodule_item',
collection: submodules) if submodules.present?
tree.html_safe
end
......
......@@ -73,6 +73,6 @@
# Rules based on role in project
if team.master?(user)
rules += project_master_rules
rules.push(*project_master_rules)
elsif team.developer?(user)
......@@ -77,5 +77,5 @@
elsif team.developer?(user)
rules += project_dev_rules
rules.push(*project_dev_rules)
elsif team.reporter?(user)
......@@ -80,5 +80,5 @@
elsif team.reporter?(user)
rules += project_report_rules
rules.push(*project_report_rules)
elsif team.guest?(user)
......@@ -83,6 +83,6 @@
elsif team.guest?(user)
rules += project_guest_rules
rules.push(*project_guest_rules)
end
if project.public? || project.internal?
......@@ -86,7 +86,7 @@
end
if project.public? || project.internal?
rules += public_project_rules
rules.push(*public_project_rules)
end
if project.owner == user || user.admin?
......@@ -90,7 +90,7 @@
end
if project.owner == user || user.admin?
rules += project_admin_rules
rules.push(*project_admin_rules)
end
if project.group && project.group.has_owner?(user)
......@@ -94,7 +94,7 @@
end
if project.group && project.group.has_owner?(user)
rules += project_admin_rules
rules.push(*project_admin_rules)
end
if project.archived?
......@@ -193,5 +193,5 @@
# Only group masters and group owners can create new projects in group
if group.has_master?(user) || group.has_owner?(user) || user.admin?
rules += [
rules.push(*[
:create_projects,
......@@ -197,6 +197,6 @@
:create_projects,
]
])
end
# Only group owner and administrators can manage group
if group.has_owner?(user) || user.admin?
......@@ -199,7 +199,7 @@
end
# Only group owner and administrators can manage group
if group.has_owner?(user) || user.admin?
rules += [
rules.push(*[
:manage_group,
:manage_namespace
......@@ -204,6 +204,6 @@
:manage_group,
:manage_namespace
]
])
end
rules.flatten
......@@ -214,6 +214,6 @@
# Only namespace owner and administrators can manage it
if namespace.owner == user || user.admin?
rules += [
rules.push(*[
:create_projects,
:manage_namespace
......@@ -218,6 +218,6 @@
:create_projects,
:manage_namespace
]
])
end
rules.flatten
......
......@@ -50,7 +50,7 @@
matches.each do |match|
identifier = match.delete "@"
if identifier == "all"
users += project.team.members.flatten
users.push(*project.team.members.flatten)
else
id = User.find_by(username: identifier).try(:id)
users << User.find(id) unless id.blank?
......
......@@ -248,7 +248,8 @@
def closes_issues
if target_branch == project.default_branch
issues = commits.flat_map { |c| c.closes_issues(project) }
issues += Gitlab::ClosingIssueExtractor.closed_by_message_in_project(description, project)
issues.push(*Gitlab::ClosingIssueExtractor.
closed_by_message_in_project(description, project))
issues.uniq.sort_by(&:id)
else
[]
......
......@@ -226,7 +226,7 @@
reserved = []
for day in time_range
reserved += @reserved[day]
reserved.push(*@reserved[day])
end
reserved.uniq!
......
......@@ -170,7 +170,7 @@
def publicish(user)
visibility_levels = [Project::PUBLIC]
visibility_levels += [Project::INTERNAL] if user
visibility_levels << Project::INTERNAL if user
where(visibility_level: visibility_levels)
end
......
......@@ -160,7 +160,7 @@
end
user_ids = project_members.pluck(:user_id)
user_ids += group_members.pluck(:user_id) if group
user_ids.push(*group_members.pluck(:user_id)) if group
User.where(id: user_ids)
end
......
......@@ -297,8 +297,8 @@
def authorized_projects
@authorized_projects ||= begin
project_ids = personal_projects.pluck(:id)
project_ids += groups_projects.pluck(:id)
project_ids += projects.pluck(:id).uniq
project_ids.push(*groups_projects.pluck(:id))
project_ids.push(*projects.pluck(:id).uniq)
Project.where(id: project_ids).joins(:namespace).order('namespaces.name ASC')
end
end
......
......@@ -12,11 +12,11 @@
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib
#{config.root}/app/models/hooks
#{config.root}/app/models/concerns
#{config.root}/app/models/project_services
#{config.root}/app/models/members)
config.autoload_paths.push(*%W(#{config.root}/lib
#{config.root}/app/models/hooks
#{config.root}/app/models/concerns
#{config.root}/app/models/project_services
#{config.root}/app/models/members))
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
......@@ -31,7 +31,7 @@
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
config.filter_parameters.push(*[:password])
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment