From 79d90cb6bd99b7af572c65af89597c2e55217aea Mon Sep 17 00:00:00 2001 From: James Ramsay Date: Thu, 2 Aug 2018 15:39:46 -0400 Subject: Use Projects::UpdateService to archive projects System hooks were not being triggered when projects were archived or unarchived. Reuse the Projects::UpdateService to automatically trigger system hooks and increase code reuse. --- lib/api/projects.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 7adde79d6c3..5738bf220c6 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -321,7 +321,7 @@ module API post ':id/archive' do authorize!(:archive_project, user_project) - user_project.archive! + ::Projects::UpdateService.new(user_project, current_user, archived: true).execute present user_project, with: Entities::Project end @@ -332,7 +332,7 @@ module API post ':id/unarchive' do authorize!(:archive_project, user_project) - user_project.unarchive! + ::Projects::UpdateService.new(@project, current_user, archived: false).execute present user_project, with: Entities::Project end -- cgit v1.2.3