Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJames Ramsay <jramsay@gitlab.com>2018-08-02 22:39:46 +0300
committerJames Ramsay <jramsay@gitlab.com>2018-08-03 18:55:21 +0300
commit79d90cb6bd99b7af572c65af89597c2e55217aea (patch)
treed28302d2bd63504b46c4eeef2877b4a3d099f893 /app
parentc60cb3935089eeb358b8e96e63d879d5b49a3dcf (diff)
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.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb4
-rw-r--r--app/models/project.rb8
2 files changed, 2 insertions, 10 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 9d1c44db137..4d7e33d7b11 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -148,7 +148,7 @@ class ProjectsController < Projects::ApplicationController
def archive
return access_denied! unless can?(current_user, :archive_project, @project)
- @project.archive!
+ ::Projects::UpdateService.new(@project, current_user, archived: true).execute
respond_to do |format|
format.html { redirect_to project_path(@project) }
@@ -158,7 +158,7 @@ class ProjectsController < Projects::ApplicationController
def unarchive
return access_denied! unless can?(current_user, :archive_project, @project)
- @project.unarchive!
+ ::Projects::UpdateService.new(@project, current_user, archived: false).execute
respond_to do |format|
format.html { redirect_to project_path(@project) }
diff --git a/app/models/project.rb b/app/models/project.rb
index 16d63639141..cf6160d9f64 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1320,14 +1320,6 @@ class Project < ActiveRecord::Base
:visibility_level
end
- def archive!
- update_attribute(:archived, true)
- end
-
- def unarchive!
- update_attribute(:archived, false)
- end
-
def change_head(branch)
if repository.branch_exists?(branch)
repository.before_change_head