Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-06-20 09:30:35 +00:00
parent c03a8f123a
commit a368425d3e
6 changed files with 54 additions and 12 deletions

View File

@ -666,7 +666,6 @@
.audit-events-patterns: &audit-events-patterns
- "{,ee/}config/audit_events/types/*.yml"
- "doc/administration/audit_event_types.md"
- "doc/user/compliance/audit_event_types.md"
- "tooling/audit_events/docs/templates/audit_event_types.md.erb"
- "lib/tasks/gitlab/audit_event_types/audit_event_types.rake"

View File

@ -1,6 +1,12 @@
- icon_name = 'bullhorn'
- dismissable = message.dismissable?
- preview = local_assigns.fetch(:preview, false)
- dismissal_data = current_user ? { dismissal_path: broadcast_message_dismissals_path } : {}
- data = { id: message.id,
expire_date: message.ends_at.iso8601,
cookie_key: Users::BroadcastMessageDismissal.get_cookie_key(message.id),
testid: 'close-button' }.merge(dismissal_data)
- unless message.notification?
.gl-broadcast-message.broadcast-banner-message.banner{ role: "alert",
@ -21,10 +27,7 @@
size: :small,
button_options: { class: 'gl-close-btn-color-inherit gl-broadcast-message-dismiss js-dismiss-current-broadcast-notification',
'aria-label': _('Close'),
data: { id: message.id,
expire_date: message.ends_at.iso8601,
dismissal_path: broadcast_message_dismissals_path,
cookie_key: Users::BroadcastMessageDismissal.get_cookie_key(message.id) } },
data: data },
icon_classes: 'gl-text-white')
- else
- notification_class = "js-broadcast-notification-#{message.id}"
@ -45,8 +48,4 @@
size: :small,
button_options: { class: 'js-dismiss-current-broadcast-notification',
'aria-label': _('Close'),
data: { id: message.id,
expire_date: message.ends_at.iso8601,
dismissal_path: broadcast_message_dismissals_path,
cookie_key: Users::BroadcastMessageDismissal.get_cookie_key(message.id),
testid: 'close-button' } })
data: data })

View File

@ -63,7 +63,7 @@ module Gitlab
)
resource_label_events.each do |event|
next if event["user"]["id"] == current_user_id
next if event.dig("user", "id") == current_user_id
# Labels are routinely added by both humans and bots, so addition events aren't cause for concern.
# However, if labels have been removed it may mean housekeeper added an incorrect label, and we shouldn't

View File

@ -266,6 +266,16 @@ RSpec.describe ::Gitlab::Housekeeper::GitlabClient do
expect(non_housekeeper_changes).to eq([])
end
end
context 'when the event user is nil' do
let(:resource_label_events) do
[{ id: 274504558, user: nil, label: { id: 2492649, name: "good label" }, action: "add" }]
end
it 'does not raise an error and return an empty array' do
expect(non_housekeeper_changes).to eq([])
end
end
end
describe '#create_or_update_merge_request' do

View File

@ -102,7 +102,7 @@ RSpec.describe Admin::BroadcastMessagesHelper, feature_category: :onboarding do
end
describe '#broadcast_message' do
let(:current_broadcast_message) { System::BroadcastMessage.new(message: 'Current Message') }
let(:current_broadcast_message) { build(:broadcast_message, message: 'Current Message') }
it 'returns nil when no current message' do
expect(helper.broadcast_message(nil)).to be_nil

View File

@ -0,0 +1,34 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'shared/_broadcast_message.html.haml', feature_category: :onboarding do
describe 'render' do
let(:dismissal_data) { "[data-dismissal-path=\"#{broadcast_message_dismissals_path}\"]" }
before do
allow(view).to receive(:current_user).and_return(current_user)
allow(view).to receive(:message).and_return(build(:broadcast_message, dismissable: true))
end
describe 'when user is authenticated' do
let(:current_user) { build(:user) }
it 'adds dismissal path' do
render 'shared/broadcast_message'
expect(rendered).to have_css(dismissal_data)
end
end
describe 'when user is not authenticated' do
let(:current_user) { nil }
it 'does not add dismissal path' do
render 'shared/broadcast_message'
expect(rendered).not_to have_css(dismissal_data)
end
end
end
end