diff --git a/ee/config/audit_events/types/project_avatar_updated.yml b/ee/config/audit_events/types/project_avatar_updated.yml new file mode 100644 index 0000000000000000000000000000000000000000..9142cee64b1980844e150ce7468b82b5c359b4cd --- /dev/null +++ b/ee/config/audit_events/types/project_avatar_updated.yml @@ -0,0 +1,9 @@ +--- +name: project_avatar_updated +description: Triggered when a project's avatar is updated +introduced_by_issue: https://gitlab.com/gitlab-org/gitlab/-/issues/8056 +introduced_by_mr: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/133375 +feature_category: groups_and_projects +milestone: '16.5' +saved_to_database: false +streamed: true diff --git a/ee/lib/audit/project_changes_auditor.rb b/ee/lib/audit/project_changes_auditor.rb index 7ab8f101079a8d85847621111e9657227e151542..f3e19b86cb9b478729c6d4abf4b487703b023ec1 100644 --- a/ee/lib/audit/project_changes_auditor.rb +++ b/ee/lib/audit/project_changes_auditor.rb @@ -3,6 +3,7 @@ module Audit class ProjectChangesAuditor < BaseChangesAuditor def execute + audit_changes(:avatar, as: 'avatar', model: model, event_type: 'project_avatar_updated') audit_changes(:description, as: 'description', model: model, event_type: 'project_description_updated') audit_changes( :visibility_level, diff --git a/ee/spec/lib/audit/project_changes_auditor_spec.rb b/ee/spec/lib/audit/project_changes_auditor_spec.rb index f65d39b7aa3eaef14e192291319e81a9ba12f71c..673c976deba4cc99244444f14def9c35e3c90ec9 100644 --- a/ee/spec/lib/audit/project_changes_auditor_spec.rb +++ b/ee/spec/lib/audit/project_changes_auditor_spec.rb @@ -15,6 +15,7 @@ visibility_level: 0, name: 'interesting name', description: "Prince", + avatar: "interesting avatar", path: 'interesting-path', repository_size_limit: 10, packages_enabled: true, @@ -107,6 +108,19 @@ it_behaves_like 'project_audit_events_from_to' end + context 'when project avatar is updated' do + let(:change) { "avatar" } + let(:event) { "project_avatar_updated" } + let(:change_from) { "interesting avatar" } + let(:change_to) { "super cool avatar" } + + before do + project.update!(avatar: "super cool avatar") + end + + it_behaves_like 'project_audit_events_from_to' + end + context 'when project name is updated' do let(:change) { "name" } let(:event) { "project_name_updated" }