Skip to content
Snippets Groups Projects
Commit 77237c5a authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 2fd92f2d
No related branches found
No related tags found
No related merge requests found
Showing
with 103 additions and 34 deletions
Loading
Loading
@@ -6,16 +6,14 @@ const handleOnDismiss = ({ currentTarget }) => {
dataset: { id },
} = currentTarget;
 
Cookies.set(`hide_broadcast_notification_message_${id}`, true);
Cookies.set(`hide_broadcast_message_${id}`, true);
 
const notification = document.querySelector(`.js-broadcast-notification-${id}`);
notification.parentNode.removeChild(notification);
};
 
export default () => {
const dismissButton = document.querySelector('.js-dismiss-current-broadcast-notification');
if (dismissButton) {
dismissButton.addEventListener('click', handleOnDismiss);
}
document
.querySelectorAll('.js-dismiss-current-broadcast-notification')
.forEach(dismissButton => dismissButton.addEventListener('click', handleOnDismiss));
};
Loading
Loading
@@ -25,9 +25,11 @@ export default () => {
 
$broadcastMessageType.on('change', () => {
const $broadcastMessageColorFormGroup = $('.js-broadcast-message-background-color-form-group');
const $broadcastMessageDismissableFormGroup = $('.js-broadcast-message-dismissable-form-group');
const $broadcastNotificationMessagePreview = $('.js-broadcast-notification-message-preview');
 
$broadcastMessageColorFormGroup.toggleClass('hidden');
$broadcastMessageDismissableFormGroup.toggleClass('hidden');
$broadcastBannerMessagePreview.toggleClass('hidden');
$broadcastNotificationMessagePreview.toggleClass('hidden');
});
Loading
Loading
Loading
Loading
@@ -17,6 +17,10 @@
@extend .broadcast-message;
@extend .alert-warning;
text-align: center;
.broadcast-message-dismiss {
color: inherit;
}
}
 
.broadcast-notification-message {
Loading
Loading
@@ -36,6 +40,11 @@
&.preview {
position: static;
}
.broadcast-message-dismiss {
height: 100%;
color: $gray-800;
}
}
 
.toggle-colors {
Loading
Loading
Loading
Loading
@@ -62,6 +62,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
starts_at
target_path
broadcast_type
dismissable
))
end
end
Loading
Loading
@@ -24,7 +24,6 @@ class Projects::MilestonesController < Projects::ApplicationController
 
respond_to do |format|
format.html do
@project_namespace = @project.namespace.becomes(Namespace)
# We need to show group milestones in the JSON response
# so that people can filter by and assign group milestones,
# but we don't need to show them on the project milestones page itself.
Loading
Loading
@@ -47,8 +46,6 @@ class Projects::MilestonesController < Projects::ApplicationController
end
 
def show
@project_namespace = @project.namespace.becomes(Namespace)
respond_to do |format|
format.html
end
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ module Repositories
include KerberosSpnegoHelper
include Gitlab::Utils::StrongMemoize
 
attr_reader :authentication_result, :redirected_path
attr_reader :authentication_result, :redirected_path, :container
 
delegate :actor, :authentication_abilities, to: :authentication_result, allow_nil: true
delegate :type, to: :authentication_result, allow_nil: true, prefix: :auth_result
Loading
Loading
@@ -81,7 +81,7 @@ module Repositories
end
 
def parse_repo_path
@project, @repo_type, @redirected_path = Gitlab::RepoPath.parse("#{params[:namespace_id]}/#{params[:repository_id]}")
@container, @project, @repo_type, @redirected_path = Gitlab::RepoPath.parse("#{params[:namespace_id]}/#{params[:repository_id]}")
end
 
def render_missing_personal_access_token
Loading
Loading
@@ -93,7 +93,7 @@ module Repositories
 
def repository
strong_memoize(:repository) do
repo_type.repository_for(project)
repo_type.repository_for(container)
end
end
 
Loading
Loading
@@ -117,7 +117,8 @@ module Repositories
def http_download_allowed?
Gitlab::ProtocolAccess.allowed?('http') &&
download_request? &&
project && Guest.can?(:download_code, project)
container &&
Guest.can?(repo_type.guest_read_ability, container)
end
end
end
Loading
Loading
Loading
Loading
@@ -84,10 +84,10 @@ module Repositories
end
 
def access
@access ||= access_klass.new(access_actor, project, 'http',
@access ||= access_klass.new(access_actor, container, 'http',
authentication_abilities: authentication_abilities,
namespace_path: params[:namespace_id],
project_path: project_path,
repository_path: repository_path,
redirected_path: redirected_path,
auth_result_type: auth_result_type)
end
Loading
Loading
@@ -99,15 +99,18 @@ module Repositories
 
def access_check
access.check(git_command, Gitlab::GitAccess::ANY)
@project ||= access.project
if repo_type.project? && !container
@project = @container = access.project
end
end
 
def access_klass
@access_klass ||= repo_type.access_checker_class
end
 
def project_path
@project_path ||= params[:repository_id].sub(/\.git$/, '')
def repository_path
@repository_path ||= params[:repository_id].sub(/\.git$/, '')
end
 
def log_user_activity
Loading
Loading
Loading
Loading
@@ -2,12 +2,14 @@
 
module BroadcastMessagesHelper
def current_broadcast_banner_messages
BroadcastMessage.current_banner_messages(request.path)
BroadcastMessage.current_banner_messages(request.path).select do |message|
cookies["hide_broadcast_message_#{message.id}"].blank?
end
end
 
def current_broadcast_notification_message
not_hidden_messages = BroadcastMessage.current_notification_messages(request.path).select do |message|
cookies["hide_broadcast_notification_message_#{message.id}"].blank?
cookies["hide_broadcast_message_#{message.id}"].blank?
end
not_hidden_messages.last
end
Loading
Loading
Loading
Loading
@@ -151,18 +151,20 @@ module MilestonesHelper
end
 
def milestone_issues_tooltip_text(milestone)
issues = milestone.count_issues_by_state(current_user)
total = milestone.total_issues_count(current_user)
opened = milestone.opened_issues_count(current_user)
closed = milestone.closed_issues_count(current_user)
 
return _("Issues") if issues.empty?
return _("Issues") if total.zero?
 
content = []
 
if issues["opened"]
content << n_("1 open issue", "%{issues} open issues", issues["opened"]) % { issues: issues["opened"] }
if opened > 0
content << n_("1 open issue", "%{issues} open issues", opened) % { issues: opened }
end
 
if issues["closed"]
content << n_("1 closed issue", "%{issues} closed issues", issues["closed"]) % { issues: issues["closed"] }
if closed > 0
content << n_("1 closed issue", "%{issues} closed issues", closed) % { issues: closed }
end
 
content.join('<br />').html_safe
Loading
Loading
Loading
Loading
@@ -2,13 +2,27 @@
 
module Milestoneish
def total_issues_count(user)
count_issues_by_state(user).values.sum
@total_issues_count ||=
if Feature.enabled?(:cached_milestone_issue_counters)
Milestones::IssuesCountService.new(self).count
else
count_issues_by_state(user).values.sum
end
end
 
def closed_issues_count(user)
closed_state_id = Issue.available_states[:closed]
@close_issues_count ||=
if Feature.enabled?(:cached_milestone_issue_counters)
Milestones::ClosedIssuesCountService.new(self).count
else
closed_state_id = Issue.available_states[:closed]
count_issues_by_state(user)[closed_state_id].to_i
end
end
 
count_issues_by_state(user)[closed_state_id].to_i
def opened_issues_count(user)
total_issues_count(user) - closed_issues_count(user)
end
 
def complete?(user)
Loading
Loading
Loading
Loading
@@ -160,6 +160,10 @@ class Snippet < ApplicationRecord
@link_reference_pattern ||= super("snippets", /(?<snippet>\d+)/)
end
 
def self.find_by_id_and_project(id:, project:)
Snippet.find_by(id: id, project: project)
end
def initialize(attributes = {})
# We can't use default_value_for because the database has a default
# value of 0 for visibility_level. If someone attempts to create a
Loading
Loading
Loading
Loading
@@ -34,6 +34,18 @@ module Issues
def update_project_counter_caches?(issue)
super || issue.confidential_changed?
end
def delete_milestone_closed_issue_counter_cache(milestone)
return unless milestone
Milestones::ClosedIssuesCountService.new(milestone).delete_cache
end
def delete_milestone_total_issue_counter_cache(milestone)
return unless milestone
Milestones::IssuesCountService.new(milestone).delete_cache
end
end
end
 
Loading
Loading
Loading
Loading
@@ -38,6 +38,8 @@ module Issues
issue.update_project_counter_caches
 
store_first_mentioned_in_commit_at(issue, closed_via) if closed_via.is_a?(MergeRequest)
delete_milestone_closed_issue_counter_cache(issue.milestone)
end
 
issue
Loading
Loading
Loading
Loading
@@ -29,6 +29,7 @@ module Issues
todo_service.new_issue(issuable, current_user)
user_agent_detail_service.create
resolve_discussions_with_issue(issuable)
delete_milestone_total_issue_counter_cache(issuable.milestone)
 
super
end
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@ module Issues
execute_hooks(issue, 'reopen')
invalidate_cache_counts(issue, users: issue.assignees)
issue.update_project_counter_caches
delete_milestone_closed_issue_counter_cache(issue.milestone)
end
 
issue
Loading
Loading
Loading
Loading
@@ -115,10 +115,26 @@ module Issues
end
 
def handle_milestone_change(issue)
return if skip_milestone_email
return unless issue.previous_changes.include?('milestone_id')
 
invalidate_milestone_issue_counters(issue)
send_milestone_change_notification(issue)
end
def invalidate_milestone_issue_counters(issue)
issue.previous_changes['milestone_id'].each do |milestone_id|
next unless milestone_id
milestone = Milestone.find_by_id(milestone_id)
delete_milestone_closed_issue_counter_cache(milestone)
delete_milestone_total_issue_counter_cache(milestone)
end
end
def send_milestone_change_notification(issue)
return if skip_milestone_email
if issue.milestone.nil?
notification_service.async.removed_milestone_issue(issue, current_user)
else
Loading
Loading
Loading
Loading
@@ -5,6 +5,10 @@
module Metrics
module Dashboard
class BaseEmbedService < ::Metrics::Dashboard::BaseService
def self.embedded?(embed_param)
ActiveModel::Type::Boolean.new.cast(embed_param)
end
def cache_key
"dynamic_metrics_dashboard_#{identifiers}"
end
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ module Metrics
# custom metrics from the DB.
def valid_params?(params)
[
params[:embedded],
embedded?(params[:embedded]),
valid_dashboard?(params[:dashboard_path]),
valid_group_title?(params[:group]),
params[:title].present?,
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ module Metrics
 
class << self
def valid_params?(params)
params[:embedded].present?
embedded?(params[:embedded])
end
end
 
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ module Metrics
# for additional info on defining custom dashboards.
def valid_params?(params)
[
params[:embedded],
embedded?(params[:embedded]),
params[:group].present?,
params[:title].present?,
params[:y_label]
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment