Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-14 21:06:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-14 21:06:24 +0300
commit8c30d396c5a789080345303330069981aa06e4af (patch)
tree6fd96c7c80bec2f1101af34d749ada58e59b38ee /app
parent429d1abad29d379d8bc8f5219eb72384ad485deb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/labels_select.js14
-rw-r--r--app/controllers/projects/commits_controller.rb2
-rw-r--r--app/finders/todos_finder.rb26
-rw-r--r--app/helpers/avatars_helper.rb23
-rw-r--r--app/models/commit.rb7
5 files changed, 42 insertions, 30 deletions
diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js
index 72de3b5d726..22b062563b5 100644
--- a/app/assets/javascripts/labels_select.js
+++ b/app/assets/javascripts/labels_select.js
@@ -32,7 +32,6 @@ export default class LabelsSelect {
$selectbox,
$sidebarCollapsedValue,
$value,
- $dropdownMenu,
abilityName,
defaultLabel,
issueUpdateURL,
@@ -68,7 +67,6 @@ export default class LabelsSelect {
$sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon span');
$sidebarLabelTooltip = $block.find('.js-sidebar-labels-tooltip');
$value = $block.find('.value');
- $dropdownMenu = $dropdown.parent().find('.dropdown-menu');
$loading = $block.find('.block-loading').fadeOut();
fieldName = $dropdown.data('fieldName');
initialSelected = $selectbox
@@ -456,21 +454,9 @@ export default class LabelsSelect {
}
$loading.fadeIn();
- const oldLabels = boardsStore.detail.issue.labels;
boardsStore.detail.issue
.update($dropdown.attr('data-issue-update'))
- .then(() => {
- if (isScopedLabel(label)) {
- const prevIds = oldLabels.map(label => label.id);
- const newIds = boardsStore.detail.issue.labels.map(label => label.id);
- const differentIds = _.difference(prevIds, newIds);
- $dropdown.data('marked', newIds);
- $dropdownMenu
- .find(differentIds.map(id => `[data-label-id="${id}"]`).join(','))
- .removeClass('is-active');
- }
- })
.then(fadeOutLoader)
.catch(fadeOutLoader);
} else if (handleClick) {
diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb
index 3007b5f1518..15bb35dd0be 100644
--- a/app/controllers/projects/commits_controller.rb
+++ b/app/controllers/projects/commits_controller.rb
@@ -72,6 +72,8 @@ class Projects::CommitsController < Projects::ApplicationController
@repository.commits(@ref, path: @path, limit: @limit, offset: @offset)
end
+ @commits.each(&:lazy_author) # preload authors
+
@commits = @commits.with_latest_pipeline(@ref)
@commits = set_commits_for_rendering(@commits)
end
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index 427fd3e7d85..2932e558a37 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -65,8 +65,20 @@ class TodosFinder
params[:action_id]
end
+ def action_array_provided?
+ params[:action].is_a?(Array)
+ end
+
+ def map_actions_to_ids
+ params[:action].map { |item| Todo::ACTION_NAMES.key(item.to_sym) }
+ end
+
def to_action_id
- Todo::ACTION_NAMES.key(action.to_sym)
+ if action_array_provided?
+ map_actions_to_ids
+ else
+ Todo::ACTION_NAMES.key(action.to_sym)
+ end
end
def action?
@@ -133,9 +145,19 @@ class TodosFinder
end
end
+ def action_id_array_provided?
+ params[:action_id].is_a?(Array) && params[:action_id].any?
+ end
+
+ def by_action_ids(items)
+ items.for_action(action_id)
+ end
+
def by_action_id(items)
+ return by_action_ids(items) if action_id_array_provided?
+
if action_id?
- items.for_action(action_id)
+ by_action_ids(items)
else
items
end
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb
index b7f7e617825..733d21daec1 100644
--- a/app/helpers/avatars_helper.rb
+++ b/app/helpers/avatars_helper.rb
@@ -56,16 +56,6 @@ module AvatarsHelper
}))
end
- def user_avatar_url_for(only_path: true, **options)
- if options[:url]
- options[:url]
- elsif options[:user]
- avatar_icon_for_user(options[:user], options[:size], only_path: only_path)
- else
- avatar_icon_for_email(options[:user_email], options[:size], only_path: only_path)
- end
- end
-
def user_avatar_without_link(options = {})
avatar_size = options[:size] || 16
user_name = options[:user].try(:name) || options[:user_name]
@@ -111,6 +101,19 @@ module AvatarsHelper
private
+ def user_avatar_url_for(only_path: true, **options)
+ return options[:url] if options[:url]
+
+ email = options[:user_email]
+ user = options.key?(:user) ? options[:user] : User.find_by_any_email(email)
+
+ if user
+ avatar_icon_for_user(user, options[:size], only_path: only_path)
+ else
+ gravatar_icon(email, options[:size])
+ end
+ end
+
def source_icon(source, options = {})
avatar_url = source.try(:avatar_url)
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 57069280ef7..aae49c36899 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -257,10 +257,9 @@ class Commit
end
def author
- # We use __sync so that we get the actual objects back (including an actual
- # nil), instead of a wrapper, as returning a wrapped nil breaks a lot of
- # code.
- lazy_author.__sync
+ strong_memoize(:author) do
+ lazy_author&.itself
+ end
end
request_cache(:author) { author_email.downcase }