Commit f609c3c1 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents b0f8572d 637b9665
......@@ -179,7 +179,12 @@ export default {
<div
class="metadata align-items-md-center d-flex flex-grow-1 flex-shrink-0 flex-wrap justify-content-md-between"
>
<item-actions v-if="isGroup" :group="group" :parent-group="parentGroup" />
<item-actions
v-if="isGroup"
:group="group"
:parent-group="parentGroup"
:action="action"
/>
<item-stats :item="group" class="group-stats gl-mt-2 d-none d-md-flex" />
</div>
</div>
......
---
title: Missing action prop on group page
merge_request: 52379
author:
type: fixed
......@@ -13,7 +13,7 @@ module EE
def audit_event_service(token, response)
message = if response.success?
"Created #{resource_type} access token with id: #{token.user.id} with scopes: #{token.scopes}"
"Created #{resource_type} access token with token_id: #{token.id} with scopes: #{token.scopes}"
else
"Attempted to create #{resource_type} access token but failed with message: #{response.message}"
end
......
......@@ -5,7 +5,7 @@ module EE
module RevokeService
def execute
super.tap do |response|
audit_event_service(bot_user, response)
audit_event_service(access_token, response)
end
end
......@@ -13,15 +13,15 @@ module EE
def audit_event_service(token, response)
message = if response.success?
"Revoked #{resource.class.name.downcase} access token with id: #{bot_user.id}"
"Revoked #{resource.class.name.downcase} access token with token_id: #{access_token.id}"
else
"Attempted to revoke #{resource.class.name.downcase} access token with id: #{bot_user.id}, but failed with message: #{response.message}"
"Attempted to revoke #{resource.class.name.downcase} access token with token_id: #{access_token.id}, but failed with message: #{response.message}"
end
::AuditEventService.new(
current_user,
resource,
target_details: bot_user.name,
target_details: access_token.user.name,
action: :custom,
custom_message: message,
ip_address: current_user.current_sign_in_ip
......
---
title: Log token_id in project access token audit events instead of user_id
merge_request: 52535
author:
type: changed
......@@ -85,7 +85,7 @@ RSpec.describe ResourceAccessTokens::CreateService do
audit_event = AuditEvent.where(author_id: user.id).last
expect(audit_event.details[:custom_message]).to eq("Created project access token with id: #{response.payload[:access_token].user.id} with scopes: #{response.payload[:access_token].scopes}")
expect(audit_event.details[:custom_message]).to eq("Created project access token with token_id: #{response.payload[:access_token].id} with scopes: #{response.payload[:access_token].scopes}")
expect(audit_event.details[:target_details]).to match(response.payload[:access_token].user.name)
end
end
......
......@@ -40,7 +40,7 @@ RSpec.describe ResourceAccessTokens::RevokeService do
audit_event = AuditEvent.where(author_id: user.id).last
expect(audit_event.details[:custom_message]).to match(/Revoked project access token with id: \d+/)
expect(audit_event.details[:custom_message]).to match(/Revoked project access token with token_id: \d+/)
expect(audit_event.details[:target_details]).to eq(access_token.user.name)
end
end
......@@ -56,7 +56,7 @@ RSpec.describe ResourceAccessTokens::RevokeService do
it 'logs the find error message' do
subject
expect(AuditEvent.where(author_id: user.id).last.details[:custom_message]).to match(/Attempted to revoke project access token with id: \d+, but failed with message: Failed to find bot user/)
expect(AuditEvent.where(author_id: user.id).last.details[:custom_message]).to match(/Attempted to revoke project access token with token_id: \d+, but failed with message: Failed to find bot user/)
end
end
......@@ -71,7 +71,7 @@ RSpec.describe ResourceAccessTokens::RevokeService do
it 'logs the permission error message' do
subject
expect(AuditEvent.where(author_id: user.id).last.details[:custom_message]).to match(/Attempted to revoke project access token with id: \d+, but failed with message: #{user.name} cannot delete #{access_token.user.name}/)
expect(AuditEvent.where(author_id: user.id).last.details[:custom_message]).to match(/Attempted to revoke project access token with token_id: \d+, but failed with message: #{user.name} cannot delete #{access_token.user.name}/)
end
end
end
......
......@@ -4,7 +4,7 @@ module Gitlab
module Utils
module Markdown
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u.freeze
PRODUCT_SUFFIX = /\s*\**\((core|starter|premium|ultimate)(\s+(only|self|sass))?\)\**/.freeze
PRODUCT_SUFFIX = /\s*\**\((core|starter|premium|ultimate|free|bronze|silver|gold)(\s+(only|self|sass))?\)\**/.freeze
def string_to_anchor(string)
string
......
......@@ -66,6 +66,22 @@ describe('ItemActions', () => {
});
});
it('emits `showLeaveGroupModal` event with the correct prefix if `action` prop is passed', () => {
const group = {
...mockParentGroupItem,
canEdit: true,
canLeave: true,
};
createComponent({
group,
action: 'test',
});
jest.spyOn(eventHub, '$emit');
findLeaveGroupBtn().vm.$emit('click', { stopPropagation: () => {} });
expect(eventHub.$emit).toHaveBeenCalledWith('testshowLeaveGroupModal', group, parentGroup);
});
it('does not render leave button if group can not be left', () => {
createComponent({
group: {
......
Markdown is supported
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